mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
[WL21389] Add out of bounds safeguard to computeShapeInfo helper (details below).
* 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
This commit is contained in:
parent
d2350974b5
commit
070c664ff2
1 changed files with 3 additions and 2 deletions
|
@ -96,7 +96,8 @@ void GeometryCache::computeSimpleHullPointListForShape(const ShapeEntityItem * c
|
|||
}
|
||||
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
const GeometryCache::ShapeData * shapeData = geometryCache->getShapeData(MAPPING[shapePtr->getShape()]);
|
||||
const GeometryCache::Shape entityGeometryShape = GeometryCache::getShapeForEntityShape(shapePtr->getShape());
|
||||
const GeometryCache::ShapeData * shapeData = geometryCache->getShapeData( entityGeometryShape );
|
||||
if (!shapeData){
|
||||
//--EARLY EXIT--( data isn't ready for some reason... )
|
||||
return;
|
||||
|
@ -522,7 +523,7 @@ const GeometryCache::ShapeData * GeometryCache::getShapeData(const Shape shape)
|
|||
|
||||
GeometryCache::Shape GeometryCache::getShapeForEntityShape(int entityShape) {
|
||||
if ((entityShape < 0) || (entityShape >= MAPPING.size())){
|
||||
return NUM_SHAPES;
|
||||
return GeometryCache::Sphere;
|
||||
}
|
||||
|
||||
return MAPPING[entityShape];
|
||||
|
|
Loading…
Reference in a new issue