Skip to content

Commit

Permalink
Fix issue with trying to get device for non device based nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
saivert committed May 24, 2024
1 parent 6d53463 commit c7c3b10
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ui/route_dropdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -178,13 +180,14 @@ mod imp {
let widget = self.obj();
let selected_handler = closure_local!(
@watch widget => move |dropdown: &gtk::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::<PwRouteObject>() {
nodeobject.set_route(&routeobject);
Expand Down

0 comments on commit c7c3b10

Please sign in to comment.