summaryrefslogtreecommitdiff
path: root/editor/import
diff options
context:
space:
mode:
authorChained Lupine <chainedlupine@gmail.com>2021-08-13 15:17:55 -0500
committerRĂ©mi Verschelde <rverschelde@gmail.com>2021-11-02 09:17:54 +0100
commit79d4edfca7c9f7bb916058fabcdfafcc126fd5bb (patch)
treeeee9fd498410cf051f56daa9038d2d40b55712bf /editor/import
parent5efb11926da99b93d342b5f417b79adf0198d3cc (diff)
Fix crash in ResourceImporterTexture::_save_stex if webp disabled
Fixes #51535.
Diffstat (limited to 'editor/import')
-rw-r--r--editor/import/resource_importer_texture.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index 96a53b3257..e4553c625b 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -218,7 +218,8 @@ void ResourceImporterTexture::get_import_options(List<ImportOption> *r_options,
void ResourceImporterTexture::save_to_stex_format(FileAccess *f, const Ref<Image> &p_image, CompressMode p_compress_mode, Image::UsedChannels p_channels, Image::CompressMode p_compress_format, float p_lossy_quality) {
switch (p_compress_mode) {
case COMPRESS_LOSSLESS: {
- bool lossless_force_png = ProjectSettings::get_singleton()->get("rendering/textures/lossless_compression/force_png");
+ bool lossless_force_png = ProjectSettings::get_singleton()->get("rendering/textures/lossless_compression/force_png") ||
+ !Image::_webp_mem_loader_func; // WebP module disabled.
bool use_webp = !lossless_force_png && p_image->get_width() <= 16383 && p_image->get_height() <= 16383; // WebP has a size limit
f->store_32(use_webp ? StreamTexture2D::DATA_FORMAT_WEBP : StreamTexture2D::DATA_FORMAT_PNG);
f->store_16(p_image->get_width());