]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/dib.cpp
(hopefully) workaround for a carbon bug not always setting the modifiers event record...
[wxWidgets.git] / src / msw / dib.cpp
index f5b86d7c2b7d740a658ad60c7654894eb724aa4a..5267d9158767bfbe070775d178a966c53eb6c6f8 100644 (file)
@@ -659,7 +659,7 @@ HPALETTE wxMakeDIBPalette(LPBITMAPINFOHEADER lpInfo)
         npPal = (LPLOGPALETTE)malloc(sizeof(LOGPALETTE) +
                                 (WORD)lpInfo->biClrUsed * sizeof(PALETTEENTRY));
         if (!npPal)
-            return(FALSE);
+            return NULL;
 
         npPal->palVersion = 0x300;
         npPal->palNumEntries = (WORD)lpInfo->biClrUsed;
@@ -695,14 +695,15 @@ HPALETTE wxMakeDIBPalette(LPBITMAPINFOHEADER lpInfo)
 
 bool wxLoadIntoBitmap(wxChar *filename, wxBitmap *bitmap, wxPalette **pal)
 {
-  HBITMAP hBitmap;
-  HPALETTE hPalette;
+  HBITMAP hBitmap = NULL;
+  HPALETTE hPalette = NULL;
 
   bool success = (wxReadDIB(filename, &hBitmap, &hPalette) != 0);
 
   if (!success)
   {
-    DeleteObject(hPalette);
+    if (hPalette)
+        DeleteObject(hPalette);
     return FALSE;
   }