From 5d2fb4ec9785d872100293614567dc6b6d65e9a1 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sat, 15 Jun 2013 12:15:54 +0200 Subject: [PATCH] WPrefs: Fix crash when switching to mouse settings panel Apparently, there is some exceptional case when the 'Mouse Grab Modifier' list can be empty, in which case the program would crash. This patch makes sure the program will not crash (that's a bad behaviour), but does not solve the empty list case Signed-off-by: Christophe CURIS --- WPrefs.app/MouseSettings.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/WPrefs.app/MouseSettings.c b/WPrefs.app/MouseSettings.c index bebf9f5d..d28f7ded 100644 --- a/WPrefs.app/MouseSettings.c +++ b/WPrefs.app/MouseSettings.c @@ -315,10 +315,13 @@ static void showData(_Panel * panel) } if (a < 1) { - sscanf(WMGetPopUpButtonItem(panel->grabP, 0), "%s", buffer); - WMSetPopUpButtonSelectedItem(panel->grabP, 0); + char *previous; + + previous = WMGetPopUpButtonItem(panel->grabP, 0); + if (previous != NULL) + WMSetPopUpButtonSelectedItem(panel->grabP, 0); wwarning(_("modifier key %s for option ModifierKey was not recognized. Using %s as default"), - str, buffer); + str, previous?previous:"(empty)"); } } -- 2.11.4.GIT