From 473f7e1445036d44350493d464502d1c2f1d9012 Mon Sep 17 00:00:00 2001 From: rkagerer Date: Sun, 12 Jul 2020 10:33:45 -0700 Subject: [PATCH] Null check in PremultiplyBitmap() Blind attempt to eliminate a crash which seems to occur when PremultiplyBitmap() is called after LoadImage() fails. I'm hoping this might fix the issue reported here: https://github.com/Open-Shell/Open-Shell-Menu/issues/400 --- Src/Lib/ResourceHelper.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Src/Lib/ResourceHelper.cpp b/Src/Lib/ResourceHelper.cpp index 76b2d40..3ab4651 100644 --- a/Src/Lib/ResourceHelper.cpp +++ b/Src/Lib/ResourceHelper.cpp @@ -332,6 +332,7 @@ HBITMAP BitmapFromIcon( HICON hIcon, int iconSize, unsigned int **pBits, bool bD // Premultiplies a DIB section by the alpha channel and a given color void PremultiplyBitmap( HBITMAP hBitmap, COLORREF rgb ) { + if (hBitmap == NULL) return; BITMAP info; GetObject(hBitmap,sizeof(info),&info); int n=info.bmWidth*info.bmHeight;