From 963557b79f5d3a91db944ed953a8c9fcab78a6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 6 Dec 2017 13:43:37 +0200 Subject: [PATCH] Query::get_structure() can also return NULL --- gstreamer/src/query.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gstreamer/src/query.rs b/gstreamer/src/query.rs index dd54b7ced..64d82d10d 100644 --- a/gstreamer/src/query.rs +++ b/gstreamer/src/query.rs @@ -120,10 +120,14 @@ impl GstRc { } impl QueryRef { - pub fn get_structure(&self) -> &StructureRef { + pub fn get_structure(&self) -> Option<&StructureRef> { unsafe { let structure = ffi::gst_query_get_structure(self.as_mut_ptr()); - StructureRef::from_glib_borrow(structure) + if structure.is_null() { + None + } else { + Some(StructureRef::from_glib_borrow(structure)) + } } }