### Godot version

b2e375824bd84f6664d484144256bcf598895875

### System information

Windows 11

### Issue description

The editor crashing when the user attempt to delete a script (even if its not attached to an object)

![crash](https://user-images.githubusercontent.com/3036176/213632164-d4dd2782-949a-4c68-bc53-86f7c5bd1f73.gif)


```
>	godot.windows.editor.dev.x86_64.exe!CowData<EditorFileSystemDirectory::FileInfo *>::_get_size() Line 81	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!CowData<EditorFileSystemDirectory::FileInfo *>::size() Line 131	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!CowData<EditorFileSystemDirectory::FileInfo *>::get(int p_index) Line 155	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!Vector<EditorFileSystemDirectory::FileInfo *>::operator[](int p_index) Line 93	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!EditorFileSystem::_update_script_classes() Line 1538	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!EditorFileSystem::_update_pending_script_classes() Line 1571	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!EditorFileSystem::update_file(const String & p_file) Line 1607	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!DependencyRemoveDialog::ok_pressed() Line 586	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!AcceptDialog::_ok_pressed() Line 127	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!call_with_variant_args_helper<AcceptDialog>(AcceptDialog * p_instance, void(AcceptDialog::*)() p_method, const Variant * * p_args, Callable::CallError & r_error, IndexSequence<> __formal) Line 298	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!call_with_variant_args<AcceptDialog>(AcceptDialog * p_instance, void(AcceptDialog::*)() p_method, const Variant * * p_args, int p_argcount, Callable::CallError & r_error) Line 408	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!CallableCustomMethodPointer<AcceptDialog>::call(const Variant * * p_arguments, int p_argcount, Variant & r_return_value, Callable::CallError & r_call_error) Line 105	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!Callable::callp(const Variant * * p_arguments, int p_argcount, Variant & r_return_value, Callable::CallError & r_call_error) Line 51	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!Object::emit_signalp(const StringName & p_name, const Variant * * p_args, int p_argcount) Line 1047	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!Object::emit_signal<>(const StringName & p_name) Line 858	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!BaseButton::_pressed() Line 139	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!BaseButton::on_action_event(Ref<InputEvent> p_event) Line 177	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!BaseButton::gui_input(const Ref<InputEvent> & p_event) Line 70	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!Control::_call_gui_input(const Ref<InputEvent> & p_event) Line 1749	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!Viewport::_gui_call_input(Control * p_control, const Ref<InputEvent> & p_input) Line 1334	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!Viewport::_gui_input_event(Ref<InputEvent> p_event) Line 1601	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!Viewport::push_input(const Ref<InputEvent> & p_event, bool p_local_coords) Line 2782	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!Window::_window_input(const Ref<InputEvent> & p_ev) Line 1344	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!call_with_variant_args_helper<Window,Ref<InputEvent> const &,0>(Window * p_instance, void(Window::*)(const Ref<InputEvent> &) p_method, const Variant * * p_args, Callable::CallError & r_error, IndexSequence<0> __formal) Line 293	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!call_with_variant_args<Window,Ref<InputEvent> const &>(Window * p_instance, void(Window::*)(const Ref<InputEvent> &) p_method, const Variant * * p_args, int p_argcount, Callable::CallError & r_error) Line 408	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!CallableCustomMethodPointer<Window,Ref<InputEvent> const &>::call(const Variant * * p_arguments, int p_argcount, Variant & r_return_value, Callable::CallError & r_call_error) Line 105	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!Callable::callp(const Variant * * p_arguments, int p_argcount, Variant & r_return_value, Callable::CallError & r_call_error) Line 51	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!DisplayServerWindows::_dispatch_input_event(const Ref<InputEvent> & p_event) Line 2291	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!DisplayServerWindows::_dispatch_input_events(const Ref<InputEvent> & p_event) Line 2256	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!Input::_parse_input_event_impl(const Ref<InputEvent> & p_event, bool p_is_emulated) Line 672	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!Input::flush_buffered_events() Line 897	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!DisplayServerWindows::process_events() Line 1985	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!OS_Windows::run() Line 1292	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!widechar_main(int argc, wchar_t * * argv) Line 181	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!_main() Line 203	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!main(int argc, char * * argv) Line 217	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 231	C++	Symbols loaded.
 	[Inline Frame] godot.windows.editor.dev.x86_64.exe!invoke_main() Line 102	C++	Symbols loaded.
 	godot.windows.editor.dev.x86_64.exe!__scrt_common_main_seh() Line 288	C++	Symbols loaded.
 	kernel32.dll!00007ff9084126bd()	Unknown	No symbols loaded.
 	ntdll.dll!00007ff90a14dfb8()	Unknown	No symbols loaded.
```

### Steps to reproduce

- Create a script
- Save scene
- Delete the script in the FileSystem

### Minimal reproduction project

[TestCrash.zip](https://github.com/godotengine/godot/files/10463784/TestCrash.zip)

Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
		Error ret = da->change_dir(cd);
		ERR_FAIL_COND_MSG(ret != OK, "Cannot change to '" + cd + "' folder.");
		da->list_dir_begin();
		while (true) {
			String f = da->get_next();
			if (f.is_empty()) {
				break;
			}
			if (da->current_is_hidden()) {
				continue;
			}
			if (da->current_is_dir()) {
				if (f.begins_with(".")) { 
					continue;
				}
				int idx = p_dir->find_dir_index(f);
				if (idx == -1) {
					if (_should_skip_directory(cd.path_join(f))) {
						continue;
					}
					EditorFileSystemDirectory *efd = memnew(EditorFileSystemDirectory);
					efd->parent = p_dir;
					efd->name = f;
					Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
					d->change_dir(cd.path_join(f));
					_scan_new_dir(efd, d, p_progress.get_sub(1, 1));
					ItemAction ia;
					ia.action = ItemAction::ACTION_DIR_ADD;
					ia.dir = p_dir;