From b15e579ea4a2f716da98893a7b05b81b9d92cb6c Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Sun, 15 Dec 2024 02:32:06 +0100 Subject: [PATCH] add some checks --- src/winapi_hooks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/winapi_hooks.c b/src/winapi_hooks.c index ca9cbdc5f4..78f7a236fd 100644 --- a/src/winapi_hooks.c +++ b/src/winapi_hooks.c @@ -1360,7 +1360,7 @@ UINT WINAPI fake_GetSystemPaletteEntries(HDC hdc, UINT iStart, UINT cEntries, LP pPalEntries, _ReturnAddress()); - if (g_ddraw.ref && g_ddraw.bpp == 8 && pPalEntries && WindowFromDC(hdc) == g_ddraw.hwnd) + if (g_ddraw.ref && g_ddraw.bpp == 8 && pPalEntries && g_ddraw.hwnd && WindowFromDC(hdc) == g_ddraw.hwnd) { TRACE(" WindowFromDC(hdc) == g_ddraw.hwnd\n"); @@ -1387,7 +1387,7 @@ UINT WINAPI fake_GetSystemPaletteEntries(HDC hdc, UINT iStart, UINT cEntries, LP HPALETTE WINAPI fake_SelectPalette(HDC hdc, HPALETTE hPal, BOOL bForceBkgd) { - if (g_ddraw.ref && g_ddraw.bpp == 8 && WindowFromDC(hdc) == g_ddraw.hwnd) + if (g_ddraw.ref && g_ddraw.bpp == 8 && g_ddraw.hwnd && WindowFromDC(hdc) == g_ddraw.hwnd) { if (g_ddraw.primary && g_ddraw.primary->palette) {