videoio: gst: Fix gst assertion on null msg
authorChristopher N. Hesse <raymanfx@gmail.com>
Wed, 6 Mar 2019 16:14:59 +0000 (17:14 +0100)
committerChristopher N. Hesse <raymanfx@gmail.com>
Wed, 6 Mar 2019 16:37:02 +0000 (17:37 +0100)
commit796b0fec7d9005d70c5f5b1b970780c28f83dca8
tree276cfdd9e0adb87b62f31684b58cdcaa93c4b601
parentd2f70f61aa552f99d0d61af2dfce97ff7cbfd41e
videoio: gst: Fix gst assertion on null msg

According to the gstreamer docs [1], the GstMessage pointer returned by
gst_bus_pop() is nullable, meaning NULL is a valid return value.

Previously, gst_is_missing_plugin_message would throw an assert when its
message object parameter would fail the GST_IS_MESSAGE macro check,
crashing the entire process (unless running in a try-catch block of course).

Instead of relying on valid messages, check if the message object itself is
valid before passing it to other gstreamer functions.

[1] https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#gst-bus-pop

Signed-off-by: Christopher N. Hesse <raymanfx@gmail.com>
modules/videoio/src/cap_gstreamer.cpp