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); + } } }