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

Point2i mp = get_local_mouse_pos();
	Point2i pos = get_line_column_at_pos(mp, false);
	int line = pos.y;
	int col = pos.x;
	if (line == -1) {
		return String();
	}
	return get_text_with_cursor_char(line, col);
}
String CodeEdit::get_text_with_cursor_char(int p_line, int p_column) const {
	const int text_size = get_line_count();
	StringBuilder result;
	for (int i = 0; i < text_size; i++) {
		String line_text = get_line(i);
		if (i == p_line && p_column >= 0 && p_column <= line_text.size()) {
			result += line_text.substr(0, p_column);
			
			result += String::chr(0xFFFF);
			result += line_text.substr(p_column, line_text.size());
		} else {
			result += line_text;
		}
		if (i != text_size - 1) {
			result += "\n";
		}
	}
	return result.as_string();
}
void CodeEdit::set_symbol_lookup_word_as_valid(bool p_valid) {