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:
parent
65e7164c42
commit
2feba10654
1 changed files with 6 additions and 6 deletions
|
@ -58,12 +58,7 @@ RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_w
|
||||||
}
|
}
|
||||||
|
|
||||||
window_sdlsurface = SDL_GetWindowSurface(window);
|
window_sdlsurface = SDL_GetWindowSurface(window);
|
||||||
if (!window_sdlsurface)
|
if (window_sdlsurface != NULL)
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
{
|
||||||
framebuffer.sdlsurface = SDL_CreateRGBSurfaceWithFormat(0, window_sdlsurface->w, window_sdlsurface->h, 0, SDL_PIXELFORMAT_RGB24);
|
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();
|
std::string error_message = std::string("Could not create framebuffer surface: ") + SDL_GetError();
|
||||||
Backend_ShowMessageBox("Fatal error (SDLSurface rendering backend)", error_message.c_str());
|
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);
|
SDL_DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue