### Godot version

v4.1.beta (a83eb16fb)

### System information

Godot v4.1.beta (a83eb16fb) - Ubuntu 20.04.2 LTS (Focal Fossa) - Vulkan (Compatibility) - NVIDIA GeForce GTX 1050 (nvidia; 470.182.03) - AMD Ryzen 7 3700X 8-Core Processor (16 Threads)

### Issue description

As the title said, an empty image will create an invalid texture and cause crash when the TexturePreview uses it.

_godot/editor/plugins/texture_editor_plugin.cpp_

```
void EditorInspectorPluginTexture::parse_begin(Object *p_object) {
	Ref<Texture> texture(Object::cast_to<Texture>(p_object));
	if (texture.is_null()) {
		Ref<Image> image(Object::cast_to<Image>(p_object));
		texture = ImageTexture::create_from_image(image);
                
                // add this below line will fix this.
                ERR_FAIL_COND_MSG(texture == nullptr, "Failed to created texture from invalid image.");
	}

	add_custom_control(memnew(TexturePreview(texture, true)));
}
```
Add sanity check after create texture will fix this. I can open a new pr to fix this if you think this is a right solution.   

![Peek 2023-06-17 12-50](https://github.com/godotengine/godot/assets/37368540/50ab9761-4268-4a9b-b951-697e8bd635de)


### Steps to reproduce

Add a new metadata with type```Resource```, after that new a ```Image``` type.

### Minimal reproduction project

No
checkerboard = memnew(TextureRect);
	checkerboard->set_stretch_mode(TextureRect::STRETCH_TILE);
	checkerboard->set_texture_repeat(CanvasItem::TEXTURE_REPEAT_ENABLED);
	checkerboard->set_custom_minimum_size(Size2(0.0, 256.0) * EDSCALE);
	add_child(checkerboard);
	texture_display = memnew(TextureRect);
	texture_display->set_texture_filter(TEXTURE_FILTER_NEAREST_WITH_MIPMAPS);
	texture_display->set_texture(p_texture);
	texture_display->set_anchors_preset(TextureRect::PRESET_FULL_RECT);
	texture_display->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED);
	texture_display->set_expand_mode(TextureRect::EXPAND_IGNORE_SIZE);
	add_child(texture_display);
	if (p_show_metadata) {
		metadata_label = memnew(Label);
		_update_metadata_label_text();
		p_texture->connect("changed", callable_mp(this, &TexturePreview::_update_metadata_label_text));
		// 
		metadata_label->add_theme_color_override("font_color", Color::named("white"));
		metadata_label->add_theme_color_override("font_shadow_color", Color::named("black"));
		metadata_label->add_theme_font_size_override("font_size", 14 * EDSCALE);
		metadata_label->add_theme_color_override("font_outline_color", Color::named("black"));
		metadata_label->add_theme_constant_override("outline_size", 8 * EDSCALE);
		metadata_label->set_h_size_flags(Control::SIZE_SHRINK_END);
		metadata_label->set_v_size_flags(Control::SIZE_SHRINK_END);
		add_child(metadata_label);
	}
}
bool EditorInspectorPluginTexture::can_handle(Object *p_object) {