[gnome-settings-daemon] wacom: Handle wrongly sized arrays
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] wacom: Handle wrongly sized arrays
- Date: Tue, 28 Feb 2012 11:14:36 +0000 (UTC)
commit 0018c53566bbb4d33b77cdf5b55d37d7d946b821
Author: Bastien Nocera <hadess hadess net>
Date: Tue Feb 28 11:14:07 2012 +0000
wacom: Handle wrongly sized arrays
For the elevator shortcut keys.
plugins/wacom/gsd-wacom-manager.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index 5770ef4..9401682 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -747,15 +747,13 @@ get_elevator_shortcut_string (GSettings *settings,
strv = g_settings_get_strv (settings, KEY_CUSTOM_ELEVATOR_ACTION);
if (strv == NULL)
return NULL;
- if (g_strv_length (strv) != 2) {
- g_strfreev (strv);
- return NULL;
- }
- if (dir == GTK_DIR_UP)
+ if (g_strv_length (strv) >= 1 && dir == GTK_DIR_UP)
str = g_strdup (strv[0]);
- else
+ else if (g_strv_length (strv) >= 2 && dir == GTK_DIR_DOWN)
str = g_strdup (strv[1]);
+ else
+ str = NULL;
g_strfreev (strv);
@@ -777,6 +775,10 @@ generate_key (GsdWacomTabletButton *wbutton,
str = get_elevator_shortcut_string (wbutton->settings, dir);
else
str = g_settings_get_string (wbutton->settings, KEY_CUSTOM_ACTION);
+
+ if (str == NULL)
+ return;
+
gtk_accelerator_parse_with_keycode (str, &keyval, &keycodes, &mods);
if (keycodes == NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]