diff options
author | stmSi <stm1998sithumyo@gmail.com> | 2022-12-18 01:34:20 +0630 |
---|---|---|
committer | stmSi <stm1998sithumyo@gmail.com> | 2022-12-21 16:39:35 +0630 |
commit | 96b0fbb7567dbbc64877c50832cd5582023e952d (patch) | |
tree | 01bb227b5ead23f49ad7ba07ffc65fd4fbae1aec /core/io | |
parent | 63f95c0e58e51ec2939e8b47803cb607fb35cadc (diff) |
Fix crashed when compressing empty image data.
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/image.cpp | 2 |
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); |