Error checking for GetOutputSurface

This commit is contained in:
Vladimir Olteanu 2021-09-05 21:11:48 +03:00 committed by Anders Jenbo
commit b87058a717
2 changed files with 8 additions and 7 deletions

View file

@ -109,9 +109,6 @@ void CreatePrimarySurface()
RendererTextureSurface = SDLWrap::CreateRGBSurfaceWithFormat(0, width, height, SDL_BITSPERPIXEL(format), format);
}
#endif
if (GetOutputSurface() == nullptr) {
ErrSdl();
}
}
void LockBufPriv()
@ -203,8 +200,6 @@ void dx_cleanup()
sgdwLockCount = 0;
MemCrit.unlock();
if (PalSurface == nullptr)
return;
PalSurface = nullptr;
PinnedPalSurface = nullptr;
Palette = nullptr;

View file

@ -257,11 +257,17 @@ bool SpawnWindow(const char *lpWindowName)
SDL_Surface *GetOutputSurface()
{
#ifdef USE_SDL1
return SDL_GetVideoSurface();
SDL_Surface *ret = SDL_GetVideoSurface();
if (ret == nullptr)
ErrSdl();
return ret;
#else
if (renderer != nullptr)
return RendererTextureSurface.get();
return SDL_GetWindowSurface(ghMainWnd);
SDL_Surface *ret = SDL_GetWindowSurface(ghMainWnd);
if (ret == nullptr)
ErrSdl();
return ret;
#endif
}