### Godot version

v4.1.1-stable_mono_win64

### System information

Windows 11

### Issue description

I removed the node to replace it with another, but when I change the path in the code, the engine crashes for me.

### Steps to reproduce

I did a screen recording as it happens:

https://github.com/godotengine/godot/assets/116289408/b2fd2689-8d82-44e8-8e02-be01674842e1



### Minimal reproduction project

[MixApo.zip](https://github.com/godotengine/godot/files/12208403/MixApo.zip)

return indent_size;
}
void CodeEdit::set_indent_using_spaces(const bool p_use_spaces) {
	indent_using_spaces = p_use_spaces;
	if (indent_using_spaces) {
		indent_text = String(" ").repeat(indent_size);
	} else {
		indent_text = "\t";
	}
}
bool CodeEdit::is_indent_using_spaces() const {
	return indent_using_spaces;
}
void CodeEdit::set_auto_indent_enabled(bool p_enabled) {
	auto_indent = p_enabled;
}
bool CodeEdit::is_auto_indent_enabled() const {
	return auto_indent;
}
void CodeEdit::set_auto_indent_prefixes(const TypedArray<String> &p_prefixes) {
	auto_indent_prefixes.clear();
	for (int i = 0; i < p_prefixes.size(); i++) {
		const String prefix = p_prefixes[i];
		auto_indent_prefixes.insert(prefix[0]);
	}
}
TypedArray<String> CodeEdit::get_auto_indent_prefixes() const {