Fix a bug that could cause assertion failure. (#5575)

Co-authored-by: macmini <xhnsworks2@icloud.com>
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
pull/5595/head
vengine 2024-05-23 03:20:22 +08:00 committed by GitHub
parent 6fa4f0ff5e
commit ec5242a1a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -148,8 +148,10 @@ void Bitmap::WriteData(aiTexture *texture, IOStream *file) {
file->Write(pixel, mBytesPerPixel, 1);
}
file->Write(padding_data, padding, 1);
// When padding is 0, passing it as an argument will cause an assertion failure in DefaultIOStream::Write.
if (padding) {
file->Write(padding_data, padding, 1);
}
}
}