- fixed: FileReader::Gets did not check for a lump's end when reading through a WADs file object.

SVN r3496 (trunk)
This commit is contained in:
Christoph Oelckers 2012-03-31 14:18:59 +00:00
parent 6f824e5ec7
commit d64ca20b31

View file

@ -145,11 +145,16 @@ long FileReader::Read (void *buffer, long len)
char *FileReader::Gets(char *strbuf, int len) char *FileReader::Gets(char *strbuf, int len)
{ {
if (len <= 0) return 0; if (len <= 0 || FilePos >= Length) return NULL;
char *p = fgets(strbuf, len, File); char *p = fgets(strbuf, len, File);
if (p != NULL) if (p != NULL)
{ {
int old = FilePos;
FilePos = ftell(File) - StartPos; FilePos = ftell(File) - StartPos;
if (FilePos > Length)
{
strbuf[Length-old] = 0;
}
} }
return p; return p;
} }