### 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.
ERR_FAIL_COND_V_MSG(p_class.is_empty(), nullptr, "Class name cannot be empty.");
	EditorData &ed = EditorNode::get_editor_data();
	
	if (p_script.is_valid()) {
		Ref<Texture2D> script_icon = ed.get_script_icon(p_script);
		if (script_icon.is_valid()) {
			return script_icon;
		}
		
		
		String base_type;
		p_script->get_language()->get_global_class_name(p_script->get_path(), &base_type);
		
		Ref<Texture2D> ext_icon = ed.extension_class_get_icon(base_type);
		if (ext_icon.is_valid()) {
			return ext_icon;
		}
		
		
		if (gui_base && gui_base->has_theme_icon(base_type, "EditorIcons")) {
			return gui_base->get_theme_icon(base_type, "EditorIcons");
		}
	}
	
	
	
	Ref<Texture2D> ext_icon = ed.extension_class_get_icon(p_class);