summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-21 18:24:52 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-21 18:24:52 +0100
commit7e30bfc9fde7685e03116457112b5bee58581242 (patch)
tree296fea8c7f9077d3ed5674fa6fda5407989501f7
parenta6283be2377d1400f688c921d5c0718753fcc4b5 (diff)
parent96b0fbb7567dbbc64877c50832cd5582023e952d (diff)
Merge pull request #70208 from stmSi/fix-crash-compressing-empty-data
Fix crashed when compressing empty image data.
-rw-r--r--core/io/image.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/io/image.cpp b/core/io/image.cpp
index 33ccd032ad..a2e1bc22be 100644
--- a/core/io/image.cpp
+++ b/core/io/image.cpp
@@ -2625,6 +2625,8 @@ Error Image::compress(CompressMode p_mode, CompressSource p_source, float p_loss
}
Error Image::compress_from_channels(CompressMode p_mode, UsedChannels p_channels, float p_lossy_quality, ASTCFormat p_astc_format) {
+ ERR_FAIL_COND_V(data.is_empty(), ERR_INVALID_DATA);
+
switch (p_mode) {
case COMPRESS_S3TC: {
ERR_FAIL_COND_V(!_image_compress_bc_func, ERR_UNAVAILABLE);