Skip to content

Commit

Permalink
add some checks
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Dec 15, 2024
1 parent 60735fc commit b15e579
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/winapi_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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)
{
Expand Down

0 comments on commit b15e579

Please sign in to comment.