Mir: Fixed crash if creating default cursor failed.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Sat, 04 Mar 2017 23:05:32 +0100
changeset 109293a44f7762496
parent 10928 fff135f69aaf
child 10930 badc1f1411ef
Mir: Fixed crash if creating default cursor failed.

Found by Cppcheck.
src/video/mir/SDL_mirmouse.c
     1.1 --- a/src/video/mir/SDL_mirmouse.c	Sat Mar 04 23:05:11 2017 +0100
     1.2 +++ b/src/video/mir/SDL_mirmouse.c	Sat Mar 04 23:05:32 2017 +0100
     1.3 @@ -140,12 +140,14 @@
     1.4  {
     1.5      char const* cursor_name = NULL;
     1.6      SDL_Cursor* cursor      = MIR_CreateDefaultCursor();
     1.7 -    MIR_Cursor* mir_cursor  = (MIR_Cursor*)cursor->driverdata;
     1.8 +    MIR_Cursor* mir_cursor;
     1.9  
    1.10      if (!cursor) {
    1.11          return NULL;
    1.12      }
    1.13  
    1.14 +    mir_cursor = (MIR_Cursor*)cursor->driverdata;
    1.15 +
    1.16      switch(id) {
    1.17          case SDL_SYSTEM_CURSOR_ARROW:
    1.18              cursor_name = MIR_mir_arrow_cursor_name;