Check for null pointer

This fixes a crash when the SESSION_MANAGER enviroment variable
is not set.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/12/head r14.1.0
Mavridis Philippe 2 years ago
parent 6eeb944213
commit 959798f451
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -413,7 +413,9 @@ void createTQApp()
initKdeSettings(); initKdeSettings();
#ifndef USE_SOLARIS #ifndef USE_SOLARIS
setenv("SESSION_MANAGER", sessionEnv, 1); if (sessionEnv) {
setenv("SESSION_MANAGER", sessionEnv, 1);
}
#else #else
char *tempEnv=(char *)malloc(strlen(sessionEnv)+strlen("SESSION_MANAGER")+2); char *tempEnv=(char *)malloc(strlen(sessionEnv)+strlen("SESSION_MANAGER")+2);
sprintf(tempEnv, "SESSION_MANAGER=%s", sessionEnv); sprintf(tempEnv, "SESSION_MANAGER=%s", sessionEnv);

Loading…
Cancel
Save