Avoid crashing when a document can't be loaded (#2453)

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
James Lindsay 2025-03-18 08:26:07 +00:00 committed by GitHub
parent 4275eaf5bf
commit 056020a56c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -777,7 +777,10 @@ impl EditorHandle {
to_front: false,
});
let document = editor.dispatcher.message_handlers.portfolio_message_handler.active_document_mut().unwrap();
let Some(document) = editor.dispatcher.message_handlers.portfolio_message_handler.active_document_mut() else {
warn!("Document wasn't loaded");
return;
};
for node in document
.network_interface
.document_network_metadata()