### 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)

for (int i = 0; i < get_gutter_count(); i++) {
		if (get_gutter_name(i) == "main_gutter") {
			main_gutter = i;
			continue;
		}
		if (get_gutter_name(i) == "line_numbers") {
			line_number_gutter = i;
			continue;
		}
		if (get_gutter_name(i) == "fold_gutter") {
			fold_gutter = i;
			continue;
		}
	}
}
void CodeEdit::_update_delimiter_cache(int p_from_line, int p_to_line) {
	if (delimiters.size() == 0) {
		return;
	}
	int line_count = get_line_count();
	if (p_to_line == -1) {
		p_to_line = line_count;
	}
	int start_line = MIN(p_from_line, p_to_line);
	int end_line = MAX(p_from_line, p_to_line);
	
	if (start_line != end_line) {