validate-scenario: Don't assume element have factories

Some elements might not originate from factories (like custom/internal
elements).

Avoids dereferencing a NULL pointer
This commit is contained in:
Edward Hervey 2017-11-23 12:27:11 +01:00 committed by Edward Hervey
parent ff6055b195
commit b5bb7d7016

View file

@ -2296,7 +2296,8 @@ _get_target_elements_by_klass_or_factory_name (GstValidateScenario * scenario,
if (klass && gst_validate_element_has_klass (pipeline, klass)) if (klass && gst_validate_element_has_klass (pipeline, klass))
result = g_list_prepend (result, gst_object_ref (pipeline)); result = g_list_prepend (result, gst_object_ref (pipeline));
if (fname && !g_strcmp0 (GST_OBJECT_NAME (gst_element_get_factory (pipeline)), if (fname && gst_element_get_factory (pipeline)
&& !g_strcmp0 (GST_OBJECT_NAME (gst_element_get_factory (pipeline)),
fname)) fname))
result = g_list_prepend (result, gst_object_ref (pipeline)); result = g_list_prepend (result, gst_object_ref (pipeline));
@ -2318,7 +2319,7 @@ _get_target_elements_by_klass_or_factory_name (GstValidateScenario * scenario,
goto next; goto next;
} }
if (fname if (fname && gst_element_get_factory (child)
&& !g_strcmp0 (GST_OBJECT_NAME (gst_element_get_factory (child)), && !g_strcmp0 (GST_OBJECT_NAME (gst_element_get_factory (child)),
fname)) fname))
result = g_list_prepend (result, gst_object_ref (child)); result = g_list_prepend (result, gst_object_ref (child));
@ -3209,7 +3210,7 @@ should_execute_action (GstElement * element, GstValidateAction * action)
tmp = tmp =
gst_structure_get_string (action->structure, gst_structure_get_string (action->structure,
"target-element-factory-name"); "target-element-factory-name");
if (tmp != NULL if (tmp != NULL && gst_element_get_factory (element)
&& !g_strcmp0 (GST_OBJECT_NAME (gst_element_get_factory (element)), tmp)) && !g_strcmp0 (GST_OBJECT_NAME (gst_element_get_factory (element)), tmp))
return TRUE; return TRUE;