From 9df22f4bf539167a77677eab3bb629d4bb906409 Mon Sep 17 00:00:00 2001 From: Willi Schinmeyer Date: Sun, 20 Jul 2014 13:36:56 +0200 Subject: [PATCH] Fix NULL flush() in PHYSFS_Io crash --- src/physfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physfs.c b/src/physfs.c index 2a68258b..a27f3d0c 100644 --- a/src/physfs.c +++ b/src/physfs.c @@ -1187,7 +1187,7 @@ static int closeFileHandleList(FileHandle **list) PHYSFS_Io *io = i->io; next = i->next; - if (!io->flush(io)) + if (io->flush && !io->flush(io)) { *list = i; return 0; @@ -2803,7 +2803,7 @@ int PHYSFS_flush(PHYSFS_File *handle) rc = io->write(io, fh->buffer + fh->bufpos, fh->buffill - fh->bufpos); BAIL_IF_MACRO(rc <= 0, ERRPASS, 0); fh->bufpos = fh->buffill = 0; - return io->flush(io); + return io->flush ? io->flush(io) : 1; } /* PHYSFS_flush */