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

if (line.contains(String::chr(0xFFFF))) {
						begin = theme_cache.font->get_string_size(line.substr(0, line.find(String::chr(0xFFFF))), HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.font_size).x;
						end = theme_cache.font->get_string_size(line.substr(0, line.rfind(String::chr(0xFFFF))), HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.font_size).x;
					}
					Point2 round_ofs = hint_ofs + theme_cache.code_hint_style->get_offset() + Vector2(0, theme_cache.font->get_ascent(theme_cache.font_size) + font_height * i + yofs);
					round_ofs = round_ofs.round();
					draw_string(theme_cache.font, round_ofs, line.replace(String::chr(0xFFFF), ""), HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.font_size, theme_cache.code_hint_color);
					if (end > 0) {
						
						const Vector2 b = hint_ofs + theme_cache.code_hint_style->get_offset() + Vector2(begin, font_height + font_height * i + yofs);
						draw_line(b, b + Vector2(end - begin, 0), theme_cache.code_hint_color, 2);
						
						const Rect2 highlight_rect = Rect2(
								b - Vector2(0, font_height),
								Vector2(end - begin, font_height));
						draw_rect(highlight_rect, theme_cache.code_hint_color * Color(1, 1, 1, 0.2));
					}
					yofs += theme_cache.line_spacing;
				}
			}
		} break;
		case NOTIFICATION_DRAG_BEGIN: {
			cancel_code_completion();
		} break;
		case NOTIFICATION_MOUSE_EXIT: {
			queue_redraw();
		} break;
	}
}
void CodeEdit::_update_theme_item_cache() {