fix(clipboard): crash when unsupported image type

This commit is contained in:
Jake Stanger 2024-11-05 13:15:42 +00:00
parent 3cd2fce333
commit 81c48fecad
No known key found for this signature in database
GPG Key ID: C51FC8F9CB0BEA61

View File

@ -209,16 +209,24 @@ impl Module<Button> for ClipboardModule {
64,
true,
Some(&Cancellable::new()),
)
.expect("Failed to read Pixbuf from stream");
let image = Image::from_pixbuf(Some(&pixbuf));
);
let button = RadioButton::from_widget(&hidden_option);
button.set_image(Some(&image));
button.set_always_show_image(true);
button.style_context().add_class("image");
match pixbuf {
Ok(pixbuf) => {
let image = Image::from_pixbuf(Some(&pixbuf));
button
let button = RadioButton::from_widget(&hidden_option);
button.set_image(Some(&image));
button.set_always_show_image(true);
button.style_context().add_class("image");
button
},
Err(err) => {
error!("{err:?}");
return;
}
}
}
ClipboardValue::Other => unreachable!(),
};