From 342b5a861a151f64c6846d00910f65f8a6775103 Mon Sep 17 00:00:00 2001
From: "Guy L. Albertelli" <guy@codeweavers.com>
Date: Fri, 7 Sep 2001 15:28:10 +0000
Subject: [PATCH] Prevent bomb when GDI_ObjPtr returns null object.

---
 graphics/x11drv/bitmap.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/graphics/x11drv/bitmap.c b/graphics/x11drv/bitmap.c
index 5ca1d358276..8d94629a5c5 100644
--- a/graphics/x11drv/bitmap.c
+++ b/graphics/x11drv/bitmap.c
@@ -595,8 +595,14 @@ Pixmap X11DRV_BITMAP_Pixmap(HBITMAP hbitmap)
 {
     Pixmap pixmap;
     BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
-    pixmap = (Pixmap)bmp->physBitmap;
-    GDI_ReleaseObj( hbitmap );
+    if (bmp) {
+      pixmap = (Pixmap)bmp->physBitmap;
+      GDI_ReleaseObj( hbitmap );
+    }
+    else {
+      ERR("handle %08x returned no obj\n", hbitmap);
+      pixmap = 0;
+    }
     return pixmap;
 }
 
-- 
GitLab