Skip to content

Commit

Permalink
Check if env is not null, since now non-fcitx standard path is nullable.
Browse files Browse the repository at this point in the history
  • Loading branch information
wengxt committed Apr 21, 2024
1 parent aafc5b5 commit 6824c95
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/fcitx-utils/standardpath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class StandardPathPrivate {
}
dir = stringutils::joinPath(home, defaultPath);
} else {
if (strcmp(env, "XDG_RUNTIME_DIR") == 0) {
if (env && strcmp(env, "XDG_RUNTIME_DIR") == 0) {
dir = stringutils::joinPath(
defaultPath,
stringutils::concat("fcitx-runtime-", geteuid()));
Expand All @@ -212,7 +212,7 @@ class StandardPathPrivate {
}
}

if (!dir.empty() && strcmp(env, "XDG_RUNTIME_DIR") == 0) {
if (!dir.empty() && env && strcmp(env, "XDG_RUNTIME_DIR") == 0) {
struct stat buf;
if (stat(dir.c_str(), &buf) != 0 || buf.st_uid != geteuid() ||
(buf.st_mode & 0777) != S_IRWXU) {
Expand Down

0 comments on commit 6824c95

Please sign in to comment.