* Switched direct map indexing to helper function which has out of bounds safeguard. * Also updated GeometryCache::getShapeForEntityShape default fallback return from GeometryCache::NUM_SHAPES to GeometryCache::Sphere inline with general preference to act as if a shape is a sphere in the event of an error. Changes Committed: modified: libraries/render-utils/src/GeometryCache.cpp
Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 1 file). Show all
Unified · Split
| @@ -96,7 +96,8 @@ void GeometryCache::computeSimpleHullPointListForShape(const ShapeEntityItem * c · 95 unmodified lines | ||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | auto geometryCache = DependencyManager::get<GeometryCache>(); |
| 99 | − const GeometryCache::ShapeData * shapeData = geometryCache->getShapeData(MAPPING[shapePtr->getShape()]); | |
| 99 | + const GeometryCache::Shape entityGeometryShape = GeometryCache::getShapeForEntityShape(shapePtr->getShape()); | |
| 100 | + const GeometryCache::ShapeData * shapeData = geometryCache->getShapeData( entityGeometryShape ); | |
| 100 | 101 | if (!shapeData){ |
| 101 | 102 | //--EARLY EXIT--( data isn't ready for some reason... ) |
| 102 | 103 | return; |
| @@ -522,7 +523,7 @@ const GeometryCache::ShapeData * GeometryCache::getShapeData(const Shape shape) · 419 unmodified lines | ||
| 522 | 523 | |
| 523 | 524 | GeometryCache::Shape GeometryCache::getShapeForEntityShape(int entityShape) { |
| 524 | 525 | if ((entityShape < 0) || (entityShape >= MAPPING.size())){ |
| 525 | − return NUM_SHAPES; | |
| 526 | + return GeometryCache::Sphere; | |
| 526 | 527 | } |
| 527 | 528 | |
| 528 | 529 | return MAPPING[entityShape]; |