1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-04 17:04:49 +00:00

Statically protect Object::cast_to for unrelated Object types.

Fix a handful of bugs associated with it.
This commit is contained in:
Lukas Tenbrink
2025-10-23 22:30:54 +02:00
parent bbe9654327
commit 0f047944e4
8 changed files with 40 additions and 51 deletions

View File

@@ -192,7 +192,7 @@ Ref<Texture2D> EditorImagePreviewPlugin::generate(const Ref<Resource> &p_from, c
Ref<Image> img = p_from;
if (img.is_null() || img->is_empty()) {
return Ref<Image>();
return Ref<Texture2D>();
}
img = img->duplicate();
@@ -200,7 +200,7 @@ Ref<Texture2D> EditorImagePreviewPlugin::generate(const Ref<Resource> &p_from, c
if (img->is_compressed()) {
if (img->decompress() != OK) {
return Ref<Image>();
return Ref<Texture2D>();
}
} else if (img->get_format() != Image::FORMAT_RGB8 && img->get_format() != Image::FORMAT_RGBA8) {
img->convert(Image::FORMAT_RGBA8);