From 62f7eb7b2fff30fb0b71b7385a4829cc2972c614 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Thu, 29 Jul 2021 16:00:04 +0300 Subject: [PATCH] Fix a crash when trying to load a WebP StreamTexture --- scene/resources/texture.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 5b92624f91e..092afd3568d 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -554,9 +554,10 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &tw_ } Ref img; - if (df & FORMAT_BIT_PNG) { + bool is_png = df & FORMAT_BIT_PNG; + if (is_png && Image::png_unpacker) { img = Image::png_unpacker(pv); - } else { + } else if (!is_png && Image::webp_unpacker) { img = Image::webp_unpacker(pv); }