1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-02 22:25:48 +01:00

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 <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2013-06-15 12:15:54 +02:00
committed by Carlos R. Mafra
parent ebac6e7c83
commit 5d2fb4ec97

View File

@@ -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)");
}
}