From 5e5c5f79457ebbcb131af4501a191fd79e03f73a Mon Sep 17 00:00:00 2001 From: Konstantinos Chatzilygeroudis Date: Wed, 20 Nov 2019 11:48:29 +0100 Subject: [PATCH] GlfwApplication: fix for empty env XDG_SESSION_TYPE --- src/Magnum/Platform/GlfwApplication.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Platform/GlfwApplication.cpp b/src/Magnum/Platform/GlfwApplication.cpp index f03770897..9d7df72f0 100644 --- a/src/Magnum/Platform/GlfwApplication.cpp +++ b/src/Magnum/Platform/GlfwApplication.cpp @@ -469,7 +469,8 @@ bool GlfwApplication::tryCreate(const Configuration& configuration, const GLConf If we are on Wayland, this is causing a segfault; a blinking window is acceptable in this case. */ constexpr const char waylandString[] = "wayland"; - if(std::strncmp(std::getenv("XDG_SESSION_TYPE"), waylandString, sizeof(waylandString)) != 0) + const char* const xdgSessionType = std::getenv("XDG_SESSION_TYPE"); + if(!xdgSessionType || std::strncmp(xdgSessionType, waylandString, sizeof(waylandString)) != 0) glfwWindowHint(GLFW_VISIBLE, false); else if(_verboseLog) Warning{} << "Platform::GlfwApplication: Wayland detected, GL context has to be created with the window visible and may cause flicker on startup";