Fix crash when XDG_CURRENT_DESKTOP isn't defined

This commit is contained in:
KockaAdmiralac 2018-12-19 22:19:18 +01:00
parent 6d23c773aa
commit 6ebb92c6b9
No known key found for this signature in database
GPG Key ID: A6007A5107D8CFBD
1 changed files with 28 additions and 23 deletions

View File

@ -281,7 +281,11 @@ Oneshot::Oneshot(RGSSThreadData &threadData) :
#endif
#ifdef OS_LINUX
std::string desktop(getenv("XDG_CURRENT_DESKTOP"));
char const* xdg_current_desktop = getenv("XDG_CURRENT_DESKTOP");
if (xdg_current_desktop == NULL) {
desktopEnv = "nope";
} else {
std::string desktop(xdg_current_desktop);
std::transform(desktop.begin(), desktop.end(), desktop.begin(), ::tolower);
if (desktop.find("cinnamon") != std::string::npos) {
desktopEnv = "cinnamon";
@ -305,6 +309,7 @@ Oneshot::Oneshot(RGSSThreadData &threadData) :
} else if (desktop.find("deepin") != std::string::npos) {
desktopEnv = "deepin";
}
}
#endif
/********