Skip to content

Commit

Permalink
fix crash on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
B0ney committed Jul 17, 2024
1 parent 5cc92f0 commit 45c4470
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub enum Message {
StartRipping,
Subscription(ripper::Message),
Crashes(crash::Message),
WindowOpened(window::Id)
WindowOpened(window::Id),
}

/// This is basically the configuration panel view.
Expand Down Expand Up @@ -106,6 +106,7 @@ impl XMODITS {
tracing::info!("Launcing GUI");

iced::daemon(XMODITS::title, XMODITS::update, XMODITS::view)
.theme(XMODITS::theme)
.settings(XMODITS::settings())
.subscription(XMODITS::subscription)
.run_with(|| XMODITS::new(config))
Expand Down Expand Up @@ -233,9 +234,13 @@ impl XMODITS {
}

fn title(&self, id: window::Id) -> String {
match Some(id) == self.main_id() {
true => self.app_title(),
false => self.sample_player.get_title(id),
if self.main_id().is_none() {
"XMODITS".into()
} else {
match Some(id) == self.main_id() {
true => self.app_title(),
false => self.sample_player.get_title(id),
}
}
}

Expand Down Expand Up @@ -265,8 +270,9 @@ impl XMODITS {
min_size: Some(WINDOW_SIZE),
exit_on_close_request: true,
..Default::default()
}).map(Message::WindowOpened)
])
})
.map(Message::WindowOpened),
]),
)
}

Expand Down Expand Up @@ -407,7 +413,7 @@ impl XMODITS {
Message::WindowOpened(id) => {
self.main_id = Some(id);
MAIN_ID.set(id);
},
}
}
Task::none()
}
Expand All @@ -423,14 +429,12 @@ impl XMODITS {

tracing::info!("{:?}", _id);
#[cfg(feature = "audio")]

// if self.main_id() != Some(_id) {
// return self
// .sample_player
// .view(_id, &self.entries)
// .map(Message::SamplePlayer);
// }

let top_left_menu = row![
button("Ripping").on_press(Message::ConfigPressed),
button("Settings").on_press(Message::SettingsPressed),
Expand Down

0 comments on commit 45c4470

Please sign in to comment.