Merge branch 'payload1/fix-ask-audio-device-only-when-audio-on' into 'master'

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

See merge request veloren/veloren!722
This commit is contained in:
Imbris 2020-01-18 18:34:17 +00:00
commit 0c4434f015

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()