From b8a87294e6cd7c645664339cc0ca8a865fe2644d Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 25 Oct 2013 14:22:56 -0700 Subject: [PATCH] added guard to protect against external child access --- libraries/voxels/src/VoxelNode.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/voxels/src/VoxelNode.cpp b/libraries/voxels/src/VoxelNode.cpp index 4e46c4e450..e83ffc1c16 100644 --- a/libraries/voxels/src/VoxelNode.cpp +++ b/libraries/voxels/src/VoxelNode.cpp @@ -409,7 +409,12 @@ VoxelNode* VoxelNode::getChildAtIndex(int childIndex) const { for (int ordinal = 1; ordinal <= childCount; ordinal++) { int index = getNthBit(_childBitmask, ordinal); if (index == childIndex) { - result = _children.external[ordinal-1]; + int externalIndex = ordinal-1; + if (externalIndex < childCount && externalIndex >= 0) { + result = _children.external[externalIndex]; + } else { + qDebug("getChildAtIndex() attempt to access external client out of bounds externalIndex=%d <<<<<<<<<< WARNING!!! \n",externalIndex); + } break; } }