v4l2object: Avoid crash on early failure
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Wed, 26 Jan 2022 14:55:09 +0000 (09:55 -0500)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Sun, 20 Feb 2022 22:32:55 +0000 (22:32 +0000)
This happens while an external error lead to an early shutdown.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1567>

subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c

index 442a963..399abab 100644 (file)
@@ -3078,7 +3078,8 @@ gst_v4l2_object_is_dmabuf_supported (GstV4l2Object * v4l2object)
     .flags = O_CLOEXEC | O_RDWR,
   };
 
-  if (v4l2object->fmtdesc->flags & V4L2_FMT_FLAG_EMULATED) {
+  if (v4l2object->fmtdesc &&
+      v4l2object->fmtdesc->flags & V4L2_FMT_FLAG_EMULATED) {
     GST_WARNING_OBJECT (v4l2object->dbg_obj,
         "libv4l2 converter detected, disabling DMABuf");
     ret = FALSE;