decklink: don't crash if there are no decklink devices

Fixes generic/states check.
This commit is contained in:
Tim-Philipp Müller 2018-01-23 14:49:51 +00:00
parent 9bb905620c
commit 2a40ab6ad6

View file

@ -1286,6 +1286,9 @@ gst_decklink_acquire_nth_output (gint n, GstElement * sink, gboolean is_audio)
g_once (&devices_once, init_devices, NULL);
if (devices == NULL)
return NULL;
if (n < 0 || (guint) n >= devices->len)
return NULL;
@ -1318,6 +1321,9 @@ gst_decklink_release_nth_output (gint n, GstElement * sink, gboolean is_audio)
GstDecklinkOutput *output;
Device *device;
if (devices == NULL)
return;
if (n < 0 || (guint) n >= devices->len)
return;
@ -1346,6 +1352,9 @@ gst_decklink_acquire_nth_input (gint n, GstElement * src, gboolean is_audio)
g_once (&devices_once, init_devices, NULL);
if (devices == NULL)
return NULL;
if (n < 0 || (guint) n >= devices->len)
return NULL;
@ -1380,6 +1389,9 @@ gst_decklink_release_nth_input (gint n, GstElement * src, gboolean is_audio)
GstDecklinkInput *input;
Device *device;
if (devices == NULL)
return;
if (n < 0 || (guint) n >= devices->len)
return;