[fix]: crash on missing video

This commit is contained in:
Chris Cochrun 2026-04-10 07:27:43 -05:00
parent 17b71e7ba3
commit cdbeccc8a3

View file

@ -195,17 +195,23 @@ impl VideoEditor {
fn update_entire_video(&mut self, video: &videos::Video) {
debug!(?video);
let Ok(mut player_video) =
Url::from_file_path(video.path.clone()).map(|url| {
gst_video::create_video(&url, 60)
.expect("Shouldn't have probs")
})
else {
let Ok(url) = Url::from_file_path(video.path.clone()) else {
self.video = None;
self.title.clone_from(&video.title);
self.core_video = Some(video.clone());
return;
};
let Ok(mut player_video) = gst_video::create_video(&url, 60)
else {
self.video = None;
self.title = format!(
"{}: {}",
String::from("Video Missing"),
&video.title
);
self.core_video = Some(video.clone());
return;
};
player_video.set_paused(true);
self.video = Some(player_video);
self.title.clone_from(&video.title);