Skip to content

Commit e5827f2

Browse files
Fix crash opening File > Export if it previously was set to the bounds of a now-deleted artboard (#3577)
fix : Crash loading export dialogue
1 parent f801ed7 commit e5827f2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

editor/src/messages/dialog/dialog_message_handler.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use super::simple_dialogs::{self, AboutGraphiteDialog, DemoArtworkDialog, LicensesDialog};
22
use crate::application::GRAPHITE_GIT_COMMIT_DATE;
33
use crate::messages::dialog::simple_dialogs::LicensesThirdPartyDialog;
4+
use crate::messages::frontend::utility_types::ExportBounds;
45
use crate::messages::layout::utility_types::widget_prelude::*;
56
use crate::messages::prelude::*;
67

@@ -85,6 +86,13 @@ impl MessageHandler<DialogMessage, DialogMessageContext<'_>> for DialogMessageHa
8586
.collect();
8687

8788
self.export_dialog.artboards = artboards;
89+
90+
if let ExportBounds::Artboard(layer) = self.export_dialog.bounds {
91+
if !self.export_dialog.artboards.contains_key(&layer) {
92+
self.export_dialog.bounds = ExportBounds::AllArtwork;
93+
}
94+
}
95+
8896
self.export_dialog.has_selection = document.network_interface.selected_nodes().selected_layers(document.metadata()).next().is_some();
8997
self.export_dialog.send_dialog_to_frontend(responses);
9098
}

editor/src/messages/dialog/export_dialog/export_dialog_message_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl LayoutHolder for ExportDialogMessageHandler {
130130
} else {
131131
self.bounds
132132
};
133-
let index = choices.iter().flatten().position(|(bounds, _, _)| *bounds == current_bounds).unwrap();
133+
let index = choices.iter().flatten().position(|(bounds, _, _)| *bounds == current_bounds).unwrap_or(0);
134134

135135
let mut entries = choices
136136
.into_iter()

0 commit comments

Comments
 (0)