Merge pull request #93404 from TokisanGames/fix-empty-scene-crash

Fix crash in Node3DEditorViewport selecting on empty scene
This commit is contained in:
Rémi Verschelde 2024-07-31 16:13:12 +02:00
commit e2be29c2a9
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 3 additions and 0 deletions

View File

@ -1051,6 +1051,9 @@ void Node3DEditorViewport::_select_region() {
Vector<Node *> selected; Vector<Node *> selected;
Node *edited_scene = get_tree()->get_edited_scene_root(); Node *edited_scene = get_tree()->get_edited_scene_root();
if (edited_scene == nullptr) {
return;
}
for (int i = 0; i < instances.size(); i++) { for (int i = 0; i < instances.size(); i++) {
Node3D *sp = Object::cast_to<Node3D>(ObjectDB::get_instance(instances[i])); Node3D *sp = Object::cast_to<Node3D>(ObjectDB::get_instance(instances[i]));