Explorar el Código

Mir: Fixed crash if creating default cursor failed.

Found by Cppcheck.
Philipp Wiesemann hace 9 años
padre
commit
72fdf62980
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      src/video/mir/SDL_mirmouse.c

+ 3 - 1
src/video/mir/SDL_mirmouse.c

@@ -140,12 +140,14 @@ MIR_CreateSystemCursor(SDL_SystemCursor id)
 {
     char const* cursor_name = NULL;
     SDL_Cursor* cursor      = MIR_CreateDefaultCursor();
-    MIR_Cursor* mir_cursor  = (MIR_Cursor*)cursor->driverdata;
+    MIR_Cursor* mir_cursor;
 
     if (!cursor) {
         return NULL;
     }
 
+    mir_cursor = (MIR_Cursor*)cursor->driverdata;
+
     switch(id) {
         case SDL_SYSTEM_CURSOR_ARROW:
             cursor_name = MIR_mir_arrow_cursor_name;