You've already forked godot
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user