From 54188c8b9e5fdaa5056723654184f460812952d4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 3 Dec 2016 09:59:43 -0800 Subject: [PATCH] Fixed crash at startup --- src/events/SDL_mouse.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 0ac993cb0..81f08de73 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -45,7 +45,11 @@ SDL_MouseNormalSpeedScaleChanged(void *userdata, const char *name, const char *o { SDL_Mouse *mouse = (SDL_Mouse *)userdata; - mouse->normal_speed_scale = (float)SDL_atof(hint); + if (hint && *hint) { + mouse->normal_speed_scale = (float)SDL_atof(hint); + } else { + mouse->normal_speed_scale = 1.0f; + } } static void @@ -53,7 +57,11 @@ SDL_MouseRelativeSpeedScaleChanged(void *userdata, const char *name, const char { SDL_Mouse *mouse = (SDL_Mouse *)userdata; - mouse->relative_speed_scale = (float)SDL_atof(hint); + if (hint && *hint) { + mouse->relative_speed_scale = (float)SDL_atof(hint); + } else { + mouse->relative_speed_scale = 1.0f; + } } /* Public functions */