From 2a40ab6ad660c37b22e82991696d0c40e70da79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 23 Jan 2018 14:49:51 +0000 Subject: [PATCH] decklink: don't crash if there are no decklink devices Fixes generic/states check. --- sys/decklink/gstdecklink.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/decklink/gstdecklink.cpp b/sys/decklink/gstdecklink.cpp index b561316920..94698a6893 100644 --- a/sys/decklink/gstdecklink.cpp +++ b/sys/decklink/gstdecklink.cpp @@ -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;