Skip to content

Commit

Permalink
[GLib] Crash opening webkit://gpu when XDG_CURRENT_DESKTOP is undefined
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=254913

Reviewed by Philippe Normand.

* Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp:
(WebKit::WebKitProtocolHandler::handleGPU): Check whether picking
XDG_CURRENT_DESKTOP from the environment returns non-null and the
variable is not empty before using it.

Canonical link: https://commits.webkit.org/262504@main
  • Loading branch information
aperezdc committed Apr 3, 2023
1 parent 110c9a0 commit 6a3c071
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp
Expand Up @@ -187,7 +187,8 @@ void WebKitProtocolHandler::handleGPU(WebKitURISchemeRequest* request)
addTableRow(versionObject, "Operating system"_s, makeString(osName.sysname, ' ', osName.release, ' ', osName.version, ' ', osName.machine));
#endif

addTableRow(versionObject, "Desktop"_s, makeString(g_getenv("XDG_CURRENT_DESKTOP")));
const char* desktopName = g_getenv("XDG_CURRENT_DESKTOP");
addTableRow(versionObject, "Desktop"_s, (desktopName && *desktopName) ? makeString(desktopName) : "Unknown"_s);

#if USE(CAIRO)
addTableRow(versionObject, "Cairo version"_s, makeString(CAIRO_VERSION_STRING, " (build) "_s, cairo_version_string(), " (runtime)"_s));
Expand Down

0 comments on commit 6a3c071

Please sign in to comment.