mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Statically protect Object::cast_to for unrelated Object types.
Fix a handful of bugs associated with it.
This commit is contained in:
parent
bbe9654327
commit
0f047944e4
8 changed files with 40 additions and 51 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue