fix UB: fwrite with buffer = NULL
This commit is contained in:
parent
d074634463
commit
3cbe922765
|
|
@ -438,7 +438,7 @@ void SafeRead( FILE *f, 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" );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user