[libdazzle] shortcuts: be defensive about NULL chain
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] shortcuts: be defensive about NULL chain
- Date: Thu, 24 Aug 2017 00:34:26 +0000 (UTC)
commit 1f8b414331c2d139d0cd80e3d2db3faba4b98d66
Author: Christian Hergert <chergert redhat com>
Date: Wed Aug 23 17:34:16 2017 -0700
shortcuts: be defensive about NULL chain
If we fail to parse detailed_action_name, we could get NULL back.
src/shortcuts/dzl-shortcut-theme.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/shortcuts/dzl-shortcut-theme.c b/src/shortcuts/dzl-shortcut-theme.c
index 07e53ce..f32ac0b 100644
--- a/src/shortcuts/dzl-shortcut-theme.c
+++ b/src/shortcuts/dzl-shortcut-theme.c
@@ -476,13 +476,17 @@ dzl_shortcut_theme_set_chord_for_action (DzlShortcutTheme *self,
phase = DZL_SHORTCUT_PHASE_BUBBLE | DZL_SHORTCUT_PHASE_GLOBAL;
if (!g_hash_table_contains (priv->chains, detailed_action_name))
- {
- DzlShortcutClosureChain *chain;
+ {
+ DzlShortcutClosureChain *chain;
+
+ chain = dzl_shortcut_closure_chain_append_action_string (NULL, detailed_action_name);
- chain = dzl_shortcut_closure_chain_append_action_string (NULL, detailed_action_name);
- chain->phase = phase;
- g_hash_table_insert (priv->chains, (gchar *)detailed_action_name, chain);
- }
+ if (chain != NULL)
+ {
+ chain->phase = phase;
+ g_hash_table_insert (priv->chains, (gchar *)detailed_action_name, chain);
+ }
+ }
}
const DzlShortcutChord *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]