From 22d74352829dc6d768e4c8c982347fe0da6d2798 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Wed, 20 Nov 2013 19:01:24 -0500 Subject: [PATCH] screen_blanker: Check if be_app is NULL ... before using it after dynamic_cast. Fixes CID 1130496 --- src/bin/screen_blanker/ScreenSaverWindow.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/bin/screen_blanker/ScreenSaverWindow.cpp b/src/bin/screen_blanker/ScreenSaverWindow.cpp index f617066e3f..27ec3076c1 100644 --- a/src/bin/screen_blanker/ScreenSaverWindow.cpp +++ b/src/bin/screen_blanker/ScreenSaverWindow.cpp @@ -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(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(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); + } } }