### Godot version

v4.1.dev3.official [a67d37f7c]

### System information

Windows 10

### Issue description

dragging upwards from the a line number in a script inside godots script editor crashes Godot. Tested in a brand new project and still occurred. Does not seem to crash when dragging downwards but dragging from a number on the lower end of the script editor seems to cause the crash often.

### Steps to reproduce

start dragging upwards from the very last line index in the script editor. Start the drag from the line number itself. Starting the drag from the line contents works as expected. Seems to crash more in scripts with more lines.

### Minimal reproduction project

N/A
ts_caret.l_caret.position.y += ts_caret.l_caret.size.y;
													ts_caret.l_caret.size.y = caret_width;
												}
												if (Math::ceil(ts_caret.l_caret.position.x) >= TS->shaped_text_get_size(rid).x) {
													ts_caret.l_caret.size.x = theme_cache.font->get_char_size('m', theme_cache.font_size).x;
												} else {
													ts_caret.l_caret.size.x = 3 * caret_width;
												}
												ts_caret.l_caret.position += Vector2(char_margin + ofs_x, ofs_y);
												if (ts_caret.l_dir == TextServer::DIRECTION_RTL) {
													ts_caret.l_caret.position.x -= ts_caret.l_caret.size.x;
												}
												draw_rect(ts_caret.l_caret, theme_cache.caret_color, overtype_mode);
											}
										} else {
											
											if (ts_caret.l_caret != Rect2() && ts_caret.l_dir == TextServer::DIRECTION_AUTO) {
												
												Rect2 trect = Rect2(ts_caret.l_caret.position.x - 2.5 * caret_width, ts_caret.l_caret.position.y, 6 * caret_width, caret_width);
												trect.position += Vector2(char_margin + ofs_x, ofs_y);
												RenderingServer::get_singleton()->canvas_item_add_rect(ci, trect, theme_cache.caret_color);
											} else if (ts_caret.l_caret != Rect2() && ts_caret.t_caret != Rect2() && ts_caret.l_dir != ts_caret.t_dir) {
												
												float d = (ts_caret.l_dir == TextServer::DIRECTION_LTR) ? 0.5 : -3;
												Rect2 trect = Rect2(ts_caret.l_caret.position.x + d * caret_width, ts_caret.l_caret.position.y + ts_caret.l_caret.size.y - caret_width, 3 * caret_width, caret_width);
												trect.position += Vector2(char_margin + ofs_x, ofs_y);
												RenderingServer::get_singleton()->canvas_item_add_rect(ci, trect, theme_cache.caret_color);
												d = (ts_caret.t_dir == TextServer::DIRECTION_LTR) ? 0.5 : -3;
												trect = Rect2(ts_caret.t_caret.position.x + d * caret_width, ts_caret.t_caret.position.y, 3 * caret_width, caret_width);
												trect.position += Vector2(char_margin + ofs_x, ofs_y);