Fixed handling of null pointer

This commit is contained in:
Robert Osfield
2016-06-29 18:01:29 +01:00
parent fb537e089b
commit a24cdb59de

View File

@@ -639,19 +639,21 @@ trpgrAppFile *trpgrAppFileCache::GetFile(trpgEndian ness,int id,int col,int row)
}
// Found it in cache, just return
if (foundID != -1) {
if (foundID != -1)
{
OpenFile &of = files[foundID];
if (of.afile->isValid())
if (of.afile)
{
of.lastUsed = timeCount;
return of.afile;
}
else
{
if (of.afile)
if (of.afile->isValid())
{
of.lastUsed = timeCount;
return of.afile;
}
else
{
delete of.afile;
of.afile = NULL;
of.afile = NULL;
}
}
}