harness: don't crash when adding a sink-harness without h->sinkpad

https://bugzilla.gnome.org/show_bug.cgi?id=755511
This commit is contained in:
Havard Graff 2015-09-24 10:23:14 +02:00 committed by Tim-Philipp Müller
parent 73263271bb
commit 64a152439c
2 changed files with 12 additions and 1 deletions

View file

@ -2241,7 +2241,7 @@ gst_harness_add_sink_harness (GstHarness * h, GstHarness * sink_harness)
h->sink_harness = sink_harness;
priv->sink_forward_pad = gst_object_ref (h->sink_harness->srcpad);
gst_harness_use_testclock (h->sink_harness);
if (priv->forwarding)
if (priv->forwarding && h->sinkpad)
gst_pad_sticky_events_foreach (h->sinkpad, forward_sticky_events, h);
gst_harness_set_forwarding (h->sink_harness, priv->forwarding);
}

View file

@ -107,6 +107,16 @@ GST_START_TEST(test_src_harness_no_forwarding)
}
GST_END_TEST;
GST_START_TEST(test_add_sink_harness_without_sinkpad)
{
GstHarness * h = gst_harness_new ("fakesink");
gst_harness_add_sink (h, "fakesink");
gst_harness_teardown (h);
}
GST_END_TEST;
static Suite *
gst_harness_suite (void)
{
@ -118,6 +128,7 @@ gst_harness_suite (void)
tcase_add_test (tc_chain, test_harness_element_ref);
tcase_add_test (tc_chain, test_src_harness);
tcase_add_test (tc_chain, test_src_harness_no_forwarding);
tcase_add_test (tc_chain, test_add_sink_harness_without_sinkpad);
return s;
}