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
1 changed files with 4 additions and 1 deletions

View File

@ -777,7 +777,10 @@ impl EditorHandle {
to_front: false, 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 for node in document
.network_interface .network_interface
.document_network_metadata() .document_network_metadata()