x11: Check return of gdk_x11_get_xatom_name_for_display

When given an invalid atom, gdk_x11_get_xatom_name_for_display can
return NULL and trigger a seg in gdk_x11_clipboard_formats_from_atoms.
Check for NULL.

Why I'm seeing a bad atom there is probably a separate question.
https://bugzilla.redhat.com/show_bug.cgi?id=2037786
This commit is contained in:
Dr. David Alan Gilbert 2022-03-31 15:56:09 +01:00
parent 04c9c6b428
commit 506566b6a4

View File

@ -248,6 +248,10 @@ gdk_x11_clipboard_formats_from_atoms (GdkDisplay *display,
const char *name;
name = gdk_x11_get_xatom_name_for_display (display , atoms[i]);
if (!name)
{
continue;
}
if (strchr (name, '/'))
{
gdk_content_formats_builder_add_mime_type (builder, name);