From 72fdf62980574e517fc95ab93ed3ee07fc0e0f6d Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Sat, 4 Mar 2017 23:05:32 +0100 Subject: [PATCH] Mir: Fixed crash if creating default cursor failed. Found by Cppcheck. --- src/video/mir/SDL_mirmouse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/video/mir/SDL_mirmouse.c b/src/video/mir/SDL_mirmouse.c index 5a2a303b0..40f774428 100644 --- a/src/video/mir/SDL_mirmouse.c +++ b/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;