From e015add1850997ecfd2e0ebfa288bbc37cc7d5a1 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 7 Aug 2010 16:57:23 +0000 Subject: [PATCH] CID 1761 : Dereferencing a potentially NULL pointer. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37953 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/screenshot/Utility.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/apps/screenshot/Utility.cpp b/src/apps/screenshot/Utility.cpp index c1dcb79fac..6ee873b5bc 100644 --- a/src/apps/screenshot/Utility.cpp +++ b/src/apps/screenshot/Utility.cpp @@ -133,9 +133,14 @@ Utility::MakeScreenshot(bool includeMouse, bool activeWindow, if (wholeScreen == NULL) return NULL; - BRect bounds = cursorBitmap->Bounds(); - int cursorWidth = bounds.IntegerWidth() + 1; - int cursorHeight = bounds.IntegerHeight() + 1; + int cursorWidth = 0; + int cursorHeight = 0; + + if (cursorBitmap != NULL) { + BRect bounds = cursorBitmap->Bounds(); + cursorWidth = bounds.IntegerWidth() + 1; + cursorHeight = bounds.IntegerHeight() + 1; + } if (includeMouse && cursorBitmap != NULL) { // Import the cursor bitmap into wholeScreen