From 202d893dc23329378b4d512e6b65924ad3742e95 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 4 May 2018 09:44:43 +0100 Subject: [PATCH] Added check for null to prevent null entries getting into the cache --- src/osgDB/ObjectCache.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/osgDB/ObjectCache.cpp b/src/osgDB/ObjectCache.cpp index 6f491890c..49518918f 100644 --- a/src/osgDB/ObjectCache.cpp +++ b/src/osgDB/ObjectCache.cpp @@ -68,6 +68,8 @@ void ObjectCache::addObjectCache(ObjectCache* objectCache) void ObjectCache::addEntryToObjectCache(const std::string& filename, osg::Object* object, double timestamp, const Options *options) { + if (!object) return; + OpenThreads::ScopedLock lock(_objectCacheMutex); _objectCache[FileNameOptionsPair(filename, options ? osg::clone(options) : 0)] = ObjectTimeStampPair(object,timestamp); OSG_DEBUG<<"Adding "<getOptionString() : "")<<"' to ObjectCache "<