From ec5242a1a0c1e90219944bdc677b168fe2be5b21 Mon Sep 17 00:00:00 2001 From: vengine Date: Thu, 23 May 2024 03:20:22 +0800 Subject: [PATCH] Fix a bug that could cause assertion failure. (#5575) Co-authored-by: macmini Co-authored-by: Kim Kulling --- code/Common/Bitmap.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/Common/Bitmap.cpp b/code/Common/Bitmap.cpp index 246ad9e651..e6732c528d 100644 --- a/code/Common/Bitmap.cpp +++ b/code/Common/Bitmap.cpp @@ -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); + } } }