fix UB: fwrite with buffer = NULL

This commit is contained in:
Garux 2021-01-01 17:42:08 +03:00
parent d074634463
commit 3cbe922765

View File

@ -438,7 +438,7 @@ void SafeRead( FILE *f, void *buffer, int count ){
void SafeWrite( FILE *f, const void *buffer, int count ){ void SafeWrite( FILE *f, const void *buffer, int count ){
if ( fwrite( buffer, 1, count, f ) != (size_t)count ) { if ( buffer != NULL && fwrite( buffer, 1, count, f ) != (size_t)count ) {
Error( "File write failure" ); Error( "File write failure" );
} }
} }