validate: Handle unknown type in foreach types
authorThibault Saunier <tsaunier@igalia.com>
Wed, 26 May 2021 01:00:09 +0000 (21:00 -0400)
committerThibault Saunier <tsaunier@igalia.com>
Thu, 27 May 2021 16:23:05 +0000 (12:23 -0400)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-devtools/-/merge_requests/248>

validate/gst/validate/gst-validate-scenario.c

index c84293e..e4e74f7 100644 (file)
@@ -523,6 +523,8 @@ gst_validate_action_new (GstValidateScenario * scenario,
 {
   GstValidateAction *action = g_slice_new0 (GstValidateAction);
 
+  g_assert (action_type);
+
   gst_validate_action_init (action);
   action->playback_time = GST_CLOCK_TIME_NONE;
   action->priv->timeout = GST_CLOCK_TIME_NONE;
@@ -3822,9 +3824,13 @@ gst_validate_create_subaction (GstValidateScenario * scenario,
     GstStructure * nstruct, gint it, gint max)
 {
   GstValidateAction *subaction;
+  GstValidateActionType *action_type =
+      _find_action_type (gst_structure_get_name (nstruct));
 
-  subaction = gst_validate_action_new (scenario,
-      _find_action_type (gst_structure_get_name (nstruct)), nstruct, FALSE);
+  if (!action_type)
+    gst_validate_error_structure (action,
+        "Unknown action type: '%s'", gst_structure_get_name (nstruct));
+  subaction = gst_validate_action_new (scenario, action_type, nstruct, FALSE);
   GST_VALIDATE_ACTION_RANGE_NAME (subaction) =
       GST_VALIDATE_ACTION_RANGE_NAME (action);
   GST_VALIDATE_ACTION_FILENAME (subaction) =