ksvideosrc: gracefully handle device prop when empty string
authorJoshua M. Doe <oss@nvl.army.mil>
Mon, 15 Oct 2018 16:46:32 +0000 (12:46 -0400)
committerNicolas Dufresne <nicolas@ndufresne.ca>
Thu, 8 Nov 2018 15:42:51 +0000 (15:42 +0000)
sys/winks/gstksvideosrc.c

index 6ef0ba9..6c73d71 100644 (file)
@@ -299,8 +299,13 @@ gst_ks_video_src_set_property (GObject * object, guint prop_id,
 
   switch (prop_id) {
     case PROP_DEVICE_PATH:
+    {
+      const gchar *device_path = g_value_get_string (value);
       g_free (priv->device_path);
-      priv->device_path = g_value_dup_string (value);
+      priv->device_path = NULL;
+      if (device_path && strlen (device_path) != 0)
+        priv->device_path = g_value_dup_string (value);
+    }
       break;
     case PROP_DEVICE_NAME:
     {