Browse Source

Fix a crash when trying to load a WebP StreamTexture

Yuri Sizov 4 năm trước cách đây
mục cha
commit
62f7eb7b2f
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      scene/resources/texture.cpp

+ 3 - 2
scene/resources/texture.cpp

@@ -554,9 +554,10 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &tw_
 			}
 
 			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);
-			} else {
+			} else if (!is_png && Image::webp_unpacker) {
 				img = Image::webp_unpacker(pv);
 			}