Skip to content

Commit

Permalink
remove device list when not found any devices
Browse files Browse the repository at this point in the history
  • Loading branch information
TuEmb committed Aug 30, 2024
1 parent 45d6734 commit 0053947
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ async fn main() -> io::Result<()> {
Ok(channels) => {
if channels.is_empty() {
let _ = ui_handle.upgrade_in_event_loop(move |ui| {
let socket_info = socket_info {
index: ModelRc::new(VecModel::from(Vec::default())),
name: ModelRc::new(VecModel::from(Vec::default())),
};
ui.set_can_sockets(socket_info);
ui.set_init_string(SharedString::from("No CAN device found !"));
});
} else {
Expand Down Expand Up @@ -136,6 +141,11 @@ async fn main() -> io::Result<()> {
}
Err(e) => {
let _ = ui_handle.upgrade_in_event_loop(move |ui| {
let socket_info = socket_info {
index: ModelRc::new(VecModel::from(Vec::default())),
name: ModelRc::new(VecModel::from(Vec::default())),
};
ui.set_can_sockets(socket_info);
ui.set_init_string(SharedString::from(format!(
"Can't get device list: {:?}",
e
Expand Down

0 comments on commit 0053947

Please sign in to comment.