From: Thiago Santos Date: Fri, 20 May 2011 18:25:08 +0000 (-0300) Subject: camerabin2: Do not segfault on null locations X-Git-Tag: 1.19.3~507^2~16050^2~132 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d25908cf81798b9d510a43160b7fc9dcd3b21397;p=platform%2Fupstream%2Fgstreamer.git camerabin2: Do not segfault on null locations Prevent capture from starting when saving location is set to NULL --- diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c index deaa880..0c8c4da 100644 --- a/gst/camerabin2/gstcamerabin2.c +++ b/gst/camerabin2/gstcamerabin2.c @@ -212,6 +212,16 @@ gst_camera_bin_start_capture (GstCameraBin * camerabin) const GstTagList *taglist; GST_DEBUG_OBJECT (camerabin, "Received start-capture"); + + /* check that we have a valid location */ + if ((camerabin->mode == MODE_VIDEO && camerabin->video_location == NULL) + || (camerabin->mode == MODE_IMAGE && camerabin->image_location == NULL)) { + GST_ELEMENT_ERROR (camerabin, RESOURCE, OPEN_WRITE, + (_("File location is set to NULL, please set it to a valid filename")), + (NULL)); + return; + } + GST_CAMERA_BIN_PROCESSING_INC (camerabin); if (camerabin->mode == MODE_VIDEO && camerabin->audio_src) {