Backends/Rendering/SDLSurface: Invert if and use != NULL instead of implicit conversion to bool

Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
This commit is contained in:
Gabriel Ravier 2020-04-12 01:00:44 +02:00
parent 65e7164c42
commit 2feba10654

View file

@ -58,12 +58,7 @@ RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_w
}
window_sdlsurface = SDL_GetWindowSurface(window);
if (!window_sdlsurface)
{
std::string error_message = std::string("Could not get SDL surface of the window: ") + SDL_GetError();
Backend_ShowMessageBox("Fatal error (SDLSurface rendering backend)", error_message.c_str());
}
else
if (window_sdlsurface != NULL)
{
framebuffer.sdlsurface = SDL_CreateRGBSurfaceWithFormat(0, window_sdlsurface->w, window_sdlsurface->h, 0, SDL_PIXELFORMAT_RGB24);
@ -77,6 +72,11 @@ RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_w
std::string error_message = std::string("Could not create framebuffer surface: ") + SDL_GetError();
Backend_ShowMessageBox("Fatal error (SDLSurface rendering backend)", error_message.c_str());
}
else
{
std::string error_message = std::string("Could not get SDL surface of the window: ") + SDL_GetError();
Backend_ShowMessageBox("Fatal error (SDLSurface rendering backend)", error_message.c_str());
}
SDL_DestroyWindow(window);
}