screen_blanker: Check if be_app is NULL

... before using it after dynamic_cast. Fixes CID 1130496
This commit is contained in:
John Scipione 2013-11-20 19:01:24 -05:00
parent 1eb5facaf4
commit 22d7435282

View File

@ -57,13 +57,15 @@ ScreenSaverFilter::Filter(BMessage* message, BHandler** target)
be_app->PostMessage(B_QUIT_REQUESTED);
break;
}
} else if (message->what == B_KEY_DOWN
&& dynamic_cast<ScreenBlanker*>(be_app)->IsPasswordWindowShown()) {
// Handle the escape key when the password window is showing
const char* string = NULL;
if (message->FindString("bytes", &string) == B_OK
&& string[0] == B_ESCAPE) {
be_app->PostMessage(kMsgResumeSaver);
} else if (message->what == B_KEY_DOWN) {
ScreenBlanker* app = dynamic_cast<ScreenBlanker*>(be_app);
if (app != NULL && app->IsPasswordWindowShown()) {
// Handle the escape key when the password window is showing
const char* string = NULL;
if (message->FindString("bytes", &string) == B_OK
&& string[0] == B_ESCAPE) {
be_app->PostMessage(kMsgResumeSaver);
}
}
}