On Sat, 15 Jun 2013 at 12:15:54 +0200, Christophe wrote:
> From: Christophe CURIS <[email protected]>
> 
> 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

I wonder how it can ever be empty, since it's a pop down list with
predefined entries.

How did you manage to get an empty entry? Or did you find this
case by inspecting the code?


> 
> Signed-off-by: Christophe CURIS <[email protected]>
> ---
>  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 bebf9f5..d28f7de 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)");
>       }
>  }
>  
> -- 
> 1.7.10.4
> 
> 
> -- 
> To unsubscribe, send mail to [email protected].


-- 
To unsubscribe, send mail to [email protected].

Reply via email to