Fix issues with invalid fourcc parameters.
authorDavid Schleef <ds@schleef.org>
Wed, 14 May 2003 18:43:36 +0000 (18:43 +0000)
committerDavid Schleef <ds@schleef.org>
Wed, 14 May 2003 18:43:36 +0000 (18:43 +0000)
Original commit message from CVS:
Fix issues with invalid fourcc parameters.

gst/videotestsrc/gstvideotestsrc.c
gst/videotestsrc/videotestsrc.c

index e3dcb5e2f6fb87043e32cf02d5dd5c76045b2d55..637d984daec317c4af5a5897ded940628214184a 100644 (file)
@@ -255,11 +255,18 @@ gst_videotestsrc_getcaps (GstPad * pad, GstCaps * caps)
 
   vts = GST_VIDEOTESTSRC (gst_pad_get_parent (pad));
 
+  caps1 = NULL;
+
   if (vts->forced_format != NULL) {
     struct fourcc_list_struct *fourcc;
+
     fourcc = paintrect_find_name (vts->forced_format);
-    caps1 = paint_get_caps(fourcc);
-  } else {
+    if (fourcc) {
+      caps1 = paint_get_caps(fourcc);
+    }
+  }
+
+  if (caps1 == NULL) {
     caps1 = gst_videotestsrc_get_capslist ();
   }
 
index b63cab865011dd77695bc6424d63d3fb55bdd1c2..56139f24e6e678750ee6be7e9f7509e2fd92f028 100644 (file)
@@ -435,6 +435,8 @@ GstCaps *paint_get_caps(struct fourcc_list_struct *format)
   unsigned int fourcc;
   GstCaps *caps;
 
+  g_return_val_if_fail(format, NULL);
+
   fourcc = GST_MAKE_FOURCC (format->fourcc[0], format->fourcc[1], format->fourcc[2], format->fourcc[3]);
 
   if(format->ext_caps){