[Scummvm-cvs-logs] CVS: scummvm/common file.cpp,1.30,1.31
Max Horn
fingolfin at users.sourceforge.net
Tue May 27 19:07:04 CEST 2003
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv8712
Modified Files:
file.cpp
Log Message:
added some missing checks for file being open before reading/writing
Index: file.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/file.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- file.cpp 21 May 2003 17:29:51 -0000 1.30
+++ file.cpp 28 May 2003 02:06:53 -0000 1.31
@@ -230,6 +230,11 @@
byte File::readByte() {
byte b;
+ if (_handle == NULL) {
+ error("File is not open!");
+ return 0;
+ }
+
if (fread(&b, 1, 1, _handle) != 1) {
clearerr(_handle);
_ioFailed = true;
@@ -292,6 +297,10 @@
void File::writeByte(byte value) {
value ^= _encbyte;
+
+ if (_handle == NULL) {
+ error("File is not open!");
+ }
if (fwrite(&value, 1, 1, _handle) != 1) {
clearerr(_handle);
More information about the Scummvm-git-logs
mailing list