Merge pull request #51014 from pycbouh/core-texture-webp-crash-3.x
[3.x] Fix a crash when trying to load a WebP `StreamTexture`
This commit is contained in:
commit
bab9c02f47
1 changed files with 3 additions and 2 deletions
|
@ -554,9 +554,10 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &tw_
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Image> img;
|
Ref<Image> img;
|
||||||
if (df & FORMAT_BIT_PNG) {
|
bool is_png = df & FORMAT_BIT_PNG;
|
||||||
|
if (is_png && Image::png_unpacker) {
|
||||||
img = Image::png_unpacker(pv);
|
img = Image::png_unpacker(pv);
|
||||||
} else {
|
} else if (!is_png && Image::webp_unpacker) {
|
||||||
img = Image::webp_unpacker(pv);
|
img = Image::webp_unpacker(pv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue