Merge pull request #70208 from stmSi/fix-crash-compressing-empty-data

Fix crashed when compressing empty image data.
This commit is contained in:
Rémi Verschelde 2022-12-21 18:24:52 +01:00
commit 7e30bfc9fd
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -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);