mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-25 07:28:11 +08:00
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:
@@ -1,6 +1,7 @@
|
|||||||
use super::simple_dialogs::{self, AboutGraphiteDialog, DemoArtworkDialog, LicensesDialog};
|
use super::simple_dialogs::{self, AboutGraphiteDialog, DemoArtworkDialog, LicensesDialog};
|
||||||
use crate::application::GRAPHITE_GIT_COMMIT_DATE;
|
use crate::application::GRAPHITE_GIT_COMMIT_DATE;
|
||||||
use crate::messages::dialog::simple_dialogs::LicensesThirdPartyDialog;
|
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::layout::utility_types::widget_prelude::*;
|
||||||
use crate::messages::prelude::*;
|
use crate::messages::prelude::*;
|
||||||
|
|
||||||
@@ -85,6 +86,13 @@ impl MessageHandler<DialogMessage, DialogMessageContext<'_>> for DialogMessageHa
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
self.export_dialog.artboards = artboards;
|
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.has_selection = document.network_interface.selected_nodes().selected_layers(document.metadata()).next().is_some();
|
||||||
self.export_dialog.send_dialog_to_frontend(responses);
|
self.export_dialog.send_dialog_to_frontend(responses);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ impl LayoutHolder for ExportDialogMessageHandler {
|
|||||||
} else {
|
} else {
|
||||||
self.bounds
|
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
|
let mut entries = choices
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|||||||
Reference in New Issue
Block a user