From 2feba10654912a5a9a581382fc39bf790d04f20f Mon Sep 17 00:00:00 2001 From: Gabriel Ravier Date: Sun, 12 Apr 2020 01:00:44 +0200 Subject: [PATCH] Backends/Rendering/SDLSurface: Invert `if` and use `!= NULL` instead of implicit conversion to `bool` Signed-off-by: Gabriel Ravier --- src/Backends/Rendering/SDLSurface.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Backends/Rendering/SDLSurface.cpp b/src/Backends/Rendering/SDLSurface.cpp index a125bc82..9b124e28 100644 --- a/src/Backends/Rendering/SDLSurface.cpp +++ b/src/Backends/Rendering/SDLSurface.cpp @@ -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); }