[libdazzle] shortcuts: handle NULL parameter safely



commit 85e6b17b8309d796937580db9ef623ef19043938
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jun 16 20:20:01 2017 -0700

    shortcuts: handle NULL parameter safely
    
    Lots of other API allows NULL for the DzlShortcutManager, so ensure that
    we handle that properly here too.

 src/shortcuts/dzl-shortcut-manager.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/shortcuts/dzl-shortcut-manager.c b/src/shortcuts/dzl-shortcut-manager.c
index 6b8e4b6..f0048f0 100644
--- a/src/shortcuts/dzl-shortcut-manager.c
+++ b/src/shortcuts/dzl-shortcut-manager.c
@@ -729,15 +729,15 @@ dzl_shortcut_manager_handle_event (DzlShortcutManager *self,
 const gchar *
 dzl_shortcut_manager_get_theme_name (DzlShortcutManager *self)
 {
-  DzlShortcutManagerPrivate *priv = dzl_shortcut_manager_get_instance_private (self);
-  const gchar *ret = NULL;
+  DzlShortcutTheme *theme;
 
   g_return_val_if_fail (DZL_IS_SHORTCUT_MANAGER (self), NULL);
 
-  if (priv->theme != NULL)
-    ret = dzl_shortcut_theme_get_name (priv->theme);
+  theme = dzl_shortcut_manager_get_theme (self);
+
+  g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (theme), NULL);
 
-  return ret;
+  return dzl_shortcut_theme_get_name (theme);
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]