diff --git a/README.md b/README.md index 0e18c811..bcd2d70d 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,7 @@ information on what to include when reporting a bug. - [Cocoa] Bugfix: A connected Apple AirPlay would emit a useless error (#1791) - [Cocoa] Bugfix: The EGL and OSMesa libraries were not unloaded on termination - [X11] Bugfix: The OSMesa libray was not unloaded on termination + - [X11] Bugfix: A malformed response during selection transfer could cause a segfault - [Wayland] Added support for file path drop events (#2040) - [Wayland] Bugfix: `glfwSetClipboardString` would fail if set to result of `glfwGetClipboardString` diff --git a/src/x11_window.c b/src/x11_window.c index fc081486..331652ec 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1049,13 +1049,16 @@ static const char* getSelectionString(Atom selection) if (!itemCount) { - if (targets[i] == XA_STRING) + if (string) { - *selectionString = convertLatin1toUTF8(string); - free(string); + if (targets[i] == XA_STRING) + { + *selectionString = convertLatin1toUTF8(string); + free(string); + } + else + *selectionString = string; } - else - *selectionString = string; break; }