From 178b479072a6fd1e579dfeef09970e522ff8f3ef Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sun, 26 Jun 2016 10:39:27 +0200 Subject: [PATCH] Prevent crash at exit due to dereference of pointer --- menu/menu_driver.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 4f42c62a95..10f53edf51 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -245,7 +245,9 @@ static void menu_driver_toggle(bool latch) runloop_ctl(RUNLOOP_CTL_SET_FRAME_TIME_LAST, NULL); } - memcpy(settings->input.binds[0], retro_keybinds_menu, + + if (settings) + memcpy(settings->input.binds[0], retro_keybinds_menu, sizeof(retro_keybinds_1)); } else @@ -262,7 +264,9 @@ static void menu_driver_toggle(bool latch) /* Restore libretro keyboard callback. */ if (key_event && frontend_key_event) *key_event = *frontend_key_event; - memcpy(settings->input.binds[0], retro_keybinds_1, + + if (settings) + memcpy(settings->input.binds[0], retro_keybinds_1, sizeof(retro_keybinds_1)); } }