Fixed "Using invalid iterator" bug in getTile() methods, detected by Covertity.

This commit is contained in:
Robert Osfield 2016-06-09 11:41:14 +01:00
parent ec8cb360c8
commit d3f5aef5ef

View File

@ -51,9 +51,7 @@ VolumeTile* Volume::getVolumeTile(const TileID& tileID)
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex); OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
VolumeTileMap::iterator itr = _volumeTileMap.find(tileID); VolumeTileMap::iterator itr = _volumeTileMap.find(tileID);
if (itr != _volumeTileMap.end()) return 0; return (itr != _volumeTileMap.end()) ? itr->second : 0;
return itr->second;
} }
const VolumeTile* Volume::getVolumeTile(const TileID& tileID) const const VolumeTile* Volume::getVolumeTile(const TileID& tileID) const
@ -61,9 +59,7 @@ const VolumeTile* Volume::getVolumeTile(const TileID& tileID) const
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex); OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
VolumeTileMap::const_iterator itr = _volumeTileMap.find(tileID); VolumeTileMap::const_iterator itr = _volumeTileMap.find(tileID);
if (itr != _volumeTileMap.end()) return 0; return (itr != _volumeTileMap.end()) ? itr->second : 0;
return itr->second;
} }
void Volume::dirtyRegisteredVolumeTiles() void Volume::dirtyRegisteredVolumeTiles()