From f6099728e419f4782cee75cc216178aa52be9492 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 23 Jan 2015 16:41:35 -0500 Subject: [PATCH] Fix #11775. BitmapDrawingEngine: - Check if fBitmap is NULL before releasing its reference. Since this is the case when a BitmapDrawingEngine is instantiated, this would lead to an app_server crash upon any attempt to make use of one. --- src/servers/app/drawing/BitmapDrawingEngine.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/servers/app/drawing/BitmapDrawingEngine.cpp b/src/servers/app/drawing/BitmapDrawingEngine.cpp index 3f37fb18f8..7a9e0ef504 100644 --- a/src/servers/app/drawing/BitmapDrawingEngine.cpp +++ b/src/servers/app/drawing/BitmapDrawingEngine.cpp @@ -48,7 +48,7 @@ BitmapDrawingEngine::SetSize(int32 newWidth, int32 newHeight) } SetHWInterface(NULL); - if (fHWInterface) { + if (fHWInterface != NULL) { fHWInterface->LockExclusiveAccess(); fHWInterface->Shutdown(); fHWInterface->UnlockExclusiveAccess(); @@ -56,8 +56,10 @@ BitmapDrawingEngine::SetSize(int32 newWidth, int32 newHeight) fHWInterface = NULL; } - fBitmap->ReleaseReference(); - fBitmap = NULL; + if (fBitmap != NULL) { + fBitmap->ReleaseReference(); + fBitmap = NULL; + } if (newWidth <= 0 || newHeight <= 0) return B_OK;