Fix crash when XDG_CURRENT_DESKTOP isn't defined
This commit is contained in:
parent
6d23c773aa
commit
6ebb92c6b9
|
|
@ -281,7 +281,11 @@ Oneshot::Oneshot(RGSSThreadData &threadData) :
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef OS_LINUX
|
#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);
|
std::transform(desktop.begin(), desktop.end(), desktop.begin(), ::tolower);
|
||||||
if (desktop.find("cinnamon") != std::string::npos) {
|
if (desktop.find("cinnamon") != std::string::npos) {
|
||||||
desktopEnv = "cinnamon";
|
desktopEnv = "cinnamon";
|
||||||
|
|
@ -305,6 +309,7 @@ Oneshot::Oneshot(RGSSThreadData &threadData) :
|
||||||
} else if (desktop.find("deepin") != std::string::npos) {
|
} else if (desktop.find("deepin") != std::string::npos) {
|
||||||
desktopEnv = "deepin";
|
desktopEnv = "deepin";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/********
|
/********
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue