### 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
#include "lightmap_gi_editor_plugin.h"
#include "editor/editor_node.h"
#include "editor/gui/editor_file_dialog.h"
void LightmapGIEditorPlugin::_bake_select_file(const String &p_file) {
	if (lightmap) {
		LightmapGI::BakeError err = LightmapGI::BAKE_ERROR_OK;
		const uint64_t time_started = OS::get_singleton()->get_ticks_msec();
		if (get_tree()->get_edited_scene_root()) {
			Ref<LightmapGIData> lightmapGIData = lightmap->get_light_data();
			if (lightmapGIData.is_valid()) {
				String path = lightmapGIData->get_path();
				if (!path.is_resource_file()) {
					int srpos = path.find("::");
					if (srpos != -1) {
						String base = path.substr(0, srpos);
						if (ResourceLoader::get_resource_type(base) == "PackedScene") {
							if (!get_tree()->get_edited_scene_root() || get_tree()->get_edited_scene_root()->get_scene_file_path() != base) {
								err = LightmapGI::BAKE_ERROR_FOREIGN_DATA;
							}
						} else {
							if (FileAccess::exists(base + ".import")) {
								err = LightmapGI::BAKE_ERROR_FOREIGN_DATA;
							}
						}