on master help sign in
AppRun: Don't try to setenv with NULL pointers, fix crash
commitf9642796e8b96800766f3210f60a26bc13be27c1 authorWill Dietz <w@wdtz.org> dateMon 26 Feb 2018, 13:02 (9 years ago) parentb2bacc2
1 file changed+1−1
AppRun.c+1−1
AppRun.c+1−1
@@ -92,7 +92,7 @@ static void add_path(const char* name, const char* rootdir) {
9292}
9393
9494#define SAVE_ENV_VAR(x) char *x = getenv(#x)
95−#define LOAD_ENV_VAR(x) setenv(#x, x, 1)
95+#define LOAD_ENV_VAR(x) do { if (x != NULL) setenv(#x, x, 1); } while(0)
9696
9797int main(int argc, char *argv[]) {
9898 char *appdir = dirname(realpath("/proc/self/exe", NULL));