From a24cdb59de2edf753fa8c2c43b0facadd43c8338 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 29 Jun 2016 18:01:29 +0100 Subject: [PATCH] Fixed handling of null pointer --- src/osgPlugins/txp/trpage_readbuf.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/osgPlugins/txp/trpage_readbuf.cpp b/src/osgPlugins/txp/trpage_readbuf.cpp index 283b193aa..8030a040a 100644 --- a/src/osgPlugins/txp/trpage_readbuf.cpp +++ b/src/osgPlugins/txp/trpage_readbuf.cpp @@ -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; + } } }