Fix panic in case no default audio device found when audio off

This commit is contained in:
Gilbert Röhrbein 2020-01-12 21:06:32 +01:00
parent cfe50129e6
commit b2503397c9

View File

@ -101,12 +101,13 @@ fn main() {
if let Err(err) = settings.save_to_file() {
panic!("Failed to save settings: {:?}", err);
}
let audio_device = match &settings.audio.audio_device {
Some(d) => d.to_string(),
None => audio::get_default_device(),
};
let mut audio = if settings.audio.audio_on {
let audio_device = match &settings.audio.audio_device {
Some(d) => d.to_string(),
None => audio::get_default_device(),
};
AudioFrontend::new(audio_device, 16)
} else {
AudioFrontend::no_audio()