ScreenSaverRunner: Fix segmentation fault loading bad screen saver.

When Settings.ModuleName() returned NULL here we got a segmentation fault
trying to access the pointer.

I ran into this trying to load up a non-screensaver executable in ScreenSaver,
it crashed instead of doing the right thing and refusing to load.

Also, since we go to the trouble of saving this to a variable, we should actually use it.
This commit is contained in:
John Scipione
2014-02-25 15:00:13 -05:00
parent 9d312ae750
commit e9a0833a86
+2 -2
View File
@@ -96,7 +96,7 @@ ScreenSaverRunner::_LoadAddOn()
_CleanUp();
const char* moduleName = fSettings.ModuleName();
if (*moduleName == '\0') {
if (moduleName == NULL || *moduleName == '\0') {
Resume();
return;
}
@@ -134,7 +134,7 @@ ScreenSaverRunner::_LoadAddOn()
fprintf(stderr, "Unable to find the instantiation function.\n");
} else {
BMessage state;
fSettings.GetModuleState(fSettings.ModuleName(), &state);
fSettings.GetModuleState(moduleName, &state);
fSaver = instantiate(&state, fAddonImage);
}