physfs.c
branchstable-1.0
changeset 900 c5172fa2c5e6
parent 870 95afd7667adf
child 949 8badfbbb3b27
--- a/physfs.c	Sat May 05 05:53:03 2007 +0000
+++ b/physfs.c	Wed Jul 11 22:11:29 2007 +0000
@@ -1797,6 +1797,8 @@
     FileHandle *h = (FileHandle *) handle->opaque;
 
     BAIL_IF_MACRO(!h->forReading, ERR_FILE_ALREADY_OPEN_W, -1);
+    BAIL_IF_MACRO(objSize == 0, NULL, 0);
+    BAIL_IF_MACRO(objCount == 0, NULL, 0);
     if (h->buffer != NULL)
         return(doBufferedRead(handle, buffer, objSize, objCount));
 
@@ -1830,6 +1832,8 @@
     FileHandle *h = (FileHandle *) handle->opaque;
 
     BAIL_IF_MACRO(h->forReading, ERR_FILE_ALREADY_OPEN_R, -1);
+    BAIL_IF_MACRO(objSize == 0, NULL, 0);
+    BAIL_IF_MACRO(objCount == 0, NULL, 0);
     if (h->buffer != NULL)
         return(doBufferedWrite(handle, buffer, objSize, objCount));