Fix crash opening File > Export if it previously was set to the bounds of a now-deleted artboard (#3577)

fix : Crash loading export dialogue
This commit is contained in:
Jatin Bharti 2026-02-18 12:54:13 +05:30 committed by GitHub
parent f801ed72bb
commit e5827f2b81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,7 @@
use super::simple_dialogs::{self, AboutGraphiteDialog, DemoArtworkDialog, LicensesDialog};
use crate::application::GRAPHITE_GIT_COMMIT_DATE;
use crate::messages::dialog::simple_dialogs::LicensesThirdPartyDialog;
use crate::messages::frontend::utility_types::ExportBounds;
use crate::messages::layout::utility_types::widget_prelude::*;
use crate::messages::prelude::*;
@ -85,6 +86,13 @@ impl MessageHandler<DialogMessage, DialogMessageContext<'_>> for DialogMessageHa
.collect();
self.export_dialog.artboards = artboards;
if let ExportBounds::Artboard(layer) = self.export_dialog.bounds {
if !self.export_dialog.artboards.contains_key(&layer) {
self.export_dialog.bounds = ExportBounds::AllArtwork;
}
}
self.export_dialog.has_selection = document.network_interface.selected_nodes().selected_layers(document.metadata()).next().is_some();
self.export_dialog.send_dialog_to_frontend(responses);
}

View File

@ -130,7 +130,7 @@ impl LayoutHolder for ExportDialogMessageHandler {
} else {
self.bounds
};
let index = choices.iter().flatten().position(|(bounds, _, _)| *bounds == current_bounds).unwrap();
let index = choices.iter().flatten().position(|(bounds, _, _)| *bounds == current_bounds).unwrap_or(0);
let mut entries = choices
.into_iter()