fix: do not ignore errors in try_calc_and_set_dimensions

This commit is contained in:
link2xt
2023-07-08 21:17:55 +00:00
parent 80fac3f1b8
commit 2fdb9f8b7e

View File

@@ -583,14 +583,22 @@ impl Message {
if (self.viewtype == Viewtype::Image || self.viewtype == Viewtype::Gif)
&& !self.param.exists(Param::Width)
{
self.param.set_int(Param::Width, 0);
self.param.set_int(Param::Height, 0);
let buf = read_file(context, &path_and_filename).await?;
if let Ok(buf) = read_file(context, path_and_filename).await {
if let Ok((width, height)) = get_filemeta(&buf) {
match get_filemeta(&buf) {
Ok((width, height)) => {
self.param.set_int(Param::Width, width as i32);
self.param.set_int(Param::Height, height as i32);
}
Err(err) => {
self.param.set_int(Param::Width, 0);
self.param.set_int(Param::Height, 0);
warn!(
context,
"Failed to get width and height for {}: {err:#}.",
path_and_filename.display()
);
}
}
if !self.id.is_unset() {