### Godot version

4.1.beta (7b1387ff2)

### System information

Mageia 9, Linux

### Issue description

When opening an empty project in latest `master`, I get these errors:
```
ERROR: Index p_idx = -1 is out of bounds (edited_scene.size() = 1).
   at: get_scene_path (editor/scu/../editor_data.cpp:880)
ERROR: Index p_idx = -1 is out of bounds (edited_scene.size() = 1).
   at: check_and_update_scene (editor/scu/../editor_data.cpp:683)
ERROR: Index p_idx = -1 is out of bounds (edited_scene.size() = 1).
   at: set_edited_scene (editor/scu/../editor_data.cpp:745)
```

Possibly related to recent changes to restore past sessions, but there's nothing to restore in this case?

### Steps to reproduce

- Create a new project, edit it
- Quit to project manager
- Re-open the newly created project -> errors

### Minimal reproduction project

Empty project.
_update_title();
	_update_scene_tabs();
	_add_to_recent_scenes(lpath);
	if (editor_folding.has_folding_data(lpath)) {
		editor_folding.load_scene_folding(new_scene, lpath);
	} else if (EDITOR_GET("interface/inspector/auto_unfold_foreign_scenes")) {
		editor_folding.unfold_scene(new_scene);
		editor_folding.save_scene_folding(new_scene, lpath);
	}
	prev_scene->set_disabled(previous_scenes.size() == 0);
	opening_prev = false;
	SceneTreeDock::get_singleton()->set_selected(new_scene);
	EditorDebuggerNode::get_singleton()->update_live_edit_root();
	push_item(new_scene);
	
	if (editor_state_cf->has_section_key("editor_states", "selected_nodes")) {
		TypedArray<NodePath> selected_node_list = editor_state_cf->get_value("editor_states", "selected_nodes", TypedArray<String>());
		for (int i = 0; i < selected_node_list.size(); i++) {
			Node *selected_node = new_scene->get_node_or_null(selected_node_list[i]);
			if (selected_node) {
				editor_selection->add_node(selected_node);
			}
		}
	}
	if (!restoring_scenes) {
		save_editor_layout_delayed();
	}
	return OK;
}
HashMap<StringName, Variant> EditorNode::get_modified_properties_for_node(Node *p_node) {