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 "<