### Godot version

v4.1.rc2.official [46424488e]

### System information

Godot v4.1.rc2 - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1050 Ti with Max-Q Design (NVIDIA; 30.0.15.1278) - Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 Threads)

### Issue description

Under certain circumstances, attempting to set Fit Content on a RichTextLabel causes Godot to freeze and eventually just close.  The problem doesn't seem to happen for me on Godot_v4.0.3-stable_win64 using the same sample project.

### Steps to reproduce

I start a new scene with a Control node as root.  I add a RichTextLabel as child of the Control and put some random text in it.  Then under Layout->transform for the label, I reset the size, which results in x of 1 and y of 0.

At this point, I check and then uncheck the Fit Content option in RichTextLabel. Everything works as expected. If after I uncheck the box, I switch over to the Control node and then switch immediately back and try to check the Fit Content box again, Godot freezes and eventually crashes.

It's happened randomly at other times, but this is the most reliable way I've found to make it always crash for me.

If I open the attached sample project, switch to the label, check and uncheck Fit Content, switch to the Control and immediately back to the label and then try to check Fit Content again, it crashes every time.

### Minimal reproduction project

[RichText Error.zip](https://github.com/godotengine/godot/files/11928707/RichText.Error.zip)

List<Item *>::Element *E = p_reverse_search ? table->subitems.back() : table->subitems.front();
				if (_search_table(table, E, p_string, p_reverse_search)) {
					return true;
				}
			} break;
			default:
				break;
		}
	}
	int sp = -1;
	if (p_reverse_search) {
		sp = txt.rfindn(p_string, p_char_idx);
	} else {
		sp = txt.findn(p_string, p_char_idx);
	}
	if (sp != -1) {
		selection.from_frame = p_frame;
		selection.from_line = p_line;
		selection.from_item = _get_item_at_pos(l.from, it_to, sp);
		selection.from_char = sp;
		selection.to_frame = p_frame;
		selection.to_line = p_line;
		selection.to_item = _get_item_at_pos(l.from, it_to, sp + p_string.length());
		selection.to_char = sp + p_string.length();
		selection.active = true;
		return true;
	}
	return false;
}
bool RichTextLabel::search(const String &p_string, bool p_from_selection, bool p_search_previous) {