Skip to content

Commit

Permalink
Fix NULL flush() in PHYSFS_Io crash
Browse files Browse the repository at this point in the history
  • Loading branch information
mrwonko committed Jul 20, 2014
1 parent 2091ecc commit 9df22f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/physfs.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */


Expand Down

0 comments on commit 9df22f4

Please sign in to comment.