From c6cbf8601216899027c8474dd28f5d994e23b76d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 24 Oct 2022 16:47:52 +0300 Subject: [PATCH] examples: glupload: Fix iterating over elements inside `glsinkbin` Some elements might not have a factory so handle this gracefully instead of erroring out. --- examples/src/glupload.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/src/glupload.rs b/examples/src/glupload.rs index 19597f458..812ab62e4 100644 --- a/examples/src/glupload.rs +++ b/examples/src/glupload.rs @@ -566,11 +566,11 @@ impl App { src.link(&sink)?; // get the glupload element to extract later the used context in it - let mut iter = sink.dynamic_cast::().unwrap().iterate_elements(); + let mut iter = sink.downcast_ref::().unwrap().iterate_elements(); let glupload = loop { match iter.next() { Ok(Some(element)) => { - if "glupload" == element.factory().unwrap().name() { + if element.factory().map_or(false, |f| f.name() == "glupload") { break Some(element); } }