Skip to content

Commit cc6f8bc

Browse files
committed
debug_ui: Do not crash Ruffle on bitmap with no pixels
When the bitmap had 0 pixels in one dimension (e.g. it was disposed of), Ruffle crashed when trying to display it.
1 parent 76bcd95 commit cc6f8bc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/src/debug_ui/display_object.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,12 @@ impl DisplayObjectWindow {
728728
) {
729729
let bitmap_data = object.bitmap_data(context.renderer);
730730
let bitmap_data = bitmap_data.read();
731+
732+
if bitmap_data.width() == 0 || bitmap_data.height() == 0 {
733+
ui.weak("(no pixels)");
734+
return;
735+
}
736+
731737
let mut egui_texture = bitmap_data.egui_texture.borrow_mut();
732738
let texture = egui_texture.get_or_insert_with(|| {
733739
let image = egui::ColorImage::from_rgba_premultiplied(

0 commit comments

Comments
 (0)