]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/dib.cpp
fixed bug with the caret positioning after SetValue() introduced by the last commit
[wxWidgets.git] / src / msw / dib.cpp
index f5b86d7c2b7d740a658ad60c7654894eb724aa4a..c48d865d23dc5011bda70f4c6d2805c5c4a0421a 100644 (file)
@@ -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;
   }