### Godot version

4.0 Stable

### System information

Windows 11, Nvidia RTX 3070ti, Ryzen 2600. Driver Version: 531.18, Vulkan

### Issue description

Baking a Lightmap on a Scene that isn't Saved and only has the LightmapGi node itself inside crashes the editor.

I'm not sure how to provide Error Logs, because I don't know where to find them.
(There aren't any log files in ```C:\Users\USERNAME\AppData\Roaming\Godot\app_userdata\projectTest```, I'm not sure if the crash logs are saved there though.)

### Steps to reproduce

1: Open a new Scene that is using the LightmapGi as the Base Node (don't save the Scene!)
2: Press the "Bake Lightmaps" button
3: Editor crashes.

### Minimal reproduction project

N/A
file_dialog->popup_file_dialog();
			} break;
			case LightmapGI::BAKE_ERROR_NO_MESHES: {
				EditorNode::get_singleton()->show_warning(TTR("No meshes to bake. Make sure they contain an UV2 channel and that the 'Bake Light' flag is on."));
			} break;
			case LightmapGI::BAKE_ERROR_CANT_CREATE_IMAGE: {
				EditorNode::get_singleton()->show_warning(TTR("Failed creating lightmap images, make sure path is writable."));
			} break;
			case LightmapGI::BAKE_ERROR_NO_SCENE_ROOT: {
				EditorNode::get_singleton()->show_warning(TTR("No editor scene root found."));
			} break;
			case LightmapGI::BAKE_ERROR_FOREIGN_DATA: {
				EditorNode::get_singleton()->show_warning(TTR("Lightmap data is not local to the scene."));
			} break;
			default: {
			} break;
		}
	}
}
void LightmapGIEditorPlugin::_bake() {
	_bake_select_file("");
}
void LightmapGIEditorPlugin::edit(Object *p_object) {
	LightmapGI *s = Object::cast_to<LightmapGI>(p_object);
	if (!s) {
		return;
	}
	lightmap = s;
}
bool LightmapGIEditorPlugin::handles(Object *p_object) const {