fix: 🐛 panic when try to open 0 size file

fix: 🐛 panic when can not open file
This commit is contained in:
Ahmet Kaan GÜMÜŞ 2024-05-14 04:30:02 +03:00
parent 7d52341f5f
commit 36d5ed509f

View file

@ -1,4 +1,4 @@
use std::{fs::File, path::Path, sync::Arc};
use std::{cmp::max, fs::File, path::Path, sync::Arc};
use iced::{
alignment,
@ -284,10 +284,12 @@ impl Streamer {
Err(err_val) => {
eprintln!("Error: Open File | {}", err_val);
self.audio_miscellaneous.file = None;
self.gui_status.are_we_play_audio = Condition::Passive;
return Command::none();
}
}
self.audio_miscellaneous.decoded_to_playing_sender = Some(
channel(
channel(max(
self.audio_miscellaneous
.file
.as_ref()
@ -296,7 +298,8 @@ impl Streamer {
.unwrap()
.len() as usize
* 4,
)
1,
))
.0,
);