From c7c3b10796d370a25821f067f2833189ab428ee3 Mon Sep 17 00:00:00 2001 From: Nicolai Syvertsen Date: Fri, 24 May 2024 17:36:47 +0200 Subject: [PATCH] Fix issue with trying to get device for non device based nodes. --- src/ui/route_dropdown.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ui/route_dropdown.rs b/src/ui/route_dropdown.rs index f482283..9d9ba01 100644 --- a/src/ui/route_dropdown.rs +++ b/src/ui/route_dropdown.rs @@ -81,7 +81,9 @@ mod imp { self.nodeobject.replace(new_nodeobject.cloned()); if let Some(nodeobject) = new_nodeobject { - let deviceobject = nodeobject.get_device().expect("device"); + let Some(deviceobject) = nodeobject.get_device() else { + return; + }; self.block_signal.set(true); pwvucontrol_info!("self.route_dropdown.set_model({});", deviceobject.wpdevice().bound_id()); @@ -178,13 +180,14 @@ mod imp { let widget = self.obj(); let selected_handler = closure_local!( @watch widget => move |dropdown: >k::DropDown, _pspec: &glib::ParamSpec| { - wp::info!("selected"); + pwvucontrol_info!("Inside selected handler"); if widget.imp().block_signal.get() { + pwvucontrol_info!("Early return from selected handler due to being blocked"); return; } if let Some(nodeobject) = widget.nodeobject() { - pwvucontrol_critical!("Had set profile to {}", dropdown.selected()); + pwvucontrol_critical!("Setting route to {}", dropdown.selected()); if let Some(routeobject) = dropdown.selected_item().and_downcast::() { nodeobject.set_route(&routeobject);