### Godot version

v4.0.beta17.mono.official [c40020513]

### System information

Window 11, Forward+, GTX 1060

### Issue description

Adding two theme variations in a row result to a  crash.

https://user-images.githubusercontent.com/93253123/217037249-1ce1d56d-beb6-4435-83ad-9f8a07fe0e96.mp4



### Steps to reproduce

1. Create a project.
2. Create a theme.
3. Double click to go in the theme editor.
4. Click on manage items buttons.
5. In the add type field type a name to add a type.
6. type another name to add a second type.
7. Crash.

### Minimal reproduction project

[ThemeVariationCrash.zip](https://github.com/godotengine/godot/files/10665863/ThemeVariationCrash.zip)

arr.push_back(idx + 1);
			arr.push_back(selected_items.size());
			ProgressDialog::get_singleton()->task_step("import_theme_items", TTR("Importing items {n}/{n}").format(arr, "{n}"), idx);
		}
		ItemCheckedState cs = E.value;
		ThemeItem ti = E.key;
		if (cs == SELECT_IMPORT_DEFINITION || cs == SELECT_IMPORT_FULL) {
			Variant item_value = Variant();
			if (cs == SELECT_IMPORT_FULL) {
				item_value = base_theme->get_theme_item(ti.data_type, ti.item_name, ti.type_name);
			} else {
				switch (ti.data_type) {
					case Theme::DATA_TYPE_COLOR:
						item_value = Color();
						break;
					case Theme::DATA_TYPE_CONSTANT:
						item_value = 0;
						break;
					case Theme::DATA_TYPE_FONT:
						item_value = Ref<Font>();
						break;
					case Theme::DATA_TYPE_FONT_SIZE:
						item_value = -1;
						break;
					case Theme::DATA_TYPE_ICON:
						item_value = Ref<Texture2D>();
						break;
					case Theme::DATA_TYPE_STYLEBOX:
						item_value = Ref<StyleBox>();
						break;