Memory Access Out of Bounds Fix

Added a necessary check to avoid out-of-bounds memory access. (Bug
caught by Daniel G.)
This commit is contained in:
mkazhdan
2015-11-12 22:30:11 -05:00
parent 6ba265b78f
commit c056c7db40
+5 -2
View File
@@ -268,8 +268,11 @@ Real Octree< Real >::GetIsoValue( const DenseNodeData< Real , FEMDegree >& solut
}
nodeValues[i] = value;
int idx = nodeWeights.index( _sNodes.treeNodes[i] );
Real w = nodeWeights.data[ idx ];
if( w!=0 ) isoValue += value * w , weightSum += w;
if( idx!=-1 )
{
Real w = nodeWeights.data[ idx ];
if( w!=0 ) isoValue += value * w , weightSum += w;
}
}
}
metSolution.resize( 0 );