mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
winlayer.c: in WM_PALETTECHANGED handling code ("someone stole the palette
so try and steal it back"), prevent calling IDirectDrawSurface_SetPalette() with NULL arguments, causing a crash. It's happened for me on Vista, when initially changing from 8-bit to 32-bit mode. git-svn-id: https://svn.eduke32.com/eduke32@2255 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a57b566c0b
commit
87ac6b8406
1 changed files with 8 additions and 1 deletions
|
@ -3706,7 +3706,14 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
|
|||
// someone stole the palette so try and steal it back
|
||||
if (bDDrawInited && bpp == 8 && fullscreen)
|
||||
{
|
||||
int32_t result = IDirectDrawSurface_SetPalette(lpDDSPrimary, lpDDPalette);
|
||||
int32_t result;
|
||||
|
||||
// PK: for me, happens on Vista when changing from fullscreen 8-bit to 32-bit
|
||||
if (!lpDDSPrimary || !lpDDPalette)
|
||||
break;
|
||||
|
||||
result = IDirectDrawSurface_SetPalette(lpDDSPrimary, lpDDPalette);
|
||||
|
||||
if (result != DD_OK)
|
||||
{
|
||||
initprintf("Palette set failed: %s\n", GetDDrawError(result));
|
||||
|
|
Loading…
Reference in a new issue