[libdazzle] properties-group: check for unexpected state type



commit aa27d2923e41625b137bcaefbdb555d611528d49
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jul 7 19:40:36 2017 -0700

    properties-group: check for unexpected state type

 src/actions/dzl-properties-group.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/actions/dzl-properties-group.c b/src/actions/dzl-properties-group.c
index e267cf1..5c92751 100644
--- a/src/actions/dzl-properties-group.c
+++ b/src/actions/dzl-properties-group.c
@@ -307,10 +307,19 @@ dzl_properties_group_change_action_state (GActionGroup *group,
 {
   DzlPropertiesGroup *self = (DzlPropertiesGroup *)group;
   g_autoptr(GObject) object = NULL;
+  const GVariantType *expected;
 
   g_assert (DZL_IS_PROPERTIES_GROUP (self));
   g_assert (name != NULL);
-  g_assert (variant != NULL);
+
+  expected = dzl_properties_group_get_action_state_type (group, name);
+
+  if (variant == NULL || !g_variant_is_of_type (variant, expected))
+    {
+      g_warning ("Invalid state for action \"%s\". Expected %s.",
+                 name, (const gchar *)expected);
+      return;
+    }
 
   object = g_weak_ref_get (&self->object_ref);
 


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