### 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
#include "texture_editor_plugin.h"
#include "editor/editor_scale.h"
#include "scene/gui/label.h"
#include "scene/gui/texture_rect.h"
TextureRect *TexturePreview::get_texture_display() {
	return texture_display;
}
void TexturePreview::_notification(int p_what) {
	switch (p_what) {
		case NOTIFICATION_ENTER_TREE:
		case NOTIFICATION_THEME_CHANGED: {
			if (!is_inside_tree()) {
				
				
				
				
				break;
			}
			if (metadata_label) {
				Ref<Font> metadata_label_font = get_theme_font(SNAME("expression"), SNAME("EditorFonts"));
				metadata_label->add_theme_font_override("font", metadata_label_font);
			}
			checkerboard->set_texture(get_theme_icon(SNAME("Checkerboard"), SNAME("EditorIcons")));
		} break;
	}
}
void TexturePreview::_update_metadata_label_text() {