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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user