Avoid out of bounds value access in vector

This commit is contained in:
Magne Sjaastad 2023-04-27 10:24:13 +02:00
parent f0b28170da
commit f3faf4642a

View File

@ -143,7 +143,8 @@ void RigFemPartResultCalculatorGamma::calculateGammaFromFrames( int
{ {
int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodResIdx ); int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodResIdx );
float por = srcPORFrameData[nodeIdx]; float por = inf;
if ( nodeIdx < srcPORFrameData.size() ) por = srcPORFrameData[nodeIdx];
if ( por == inf || fabs( por ) < 0.01e6 * 1.0e-5 ) if ( por == inf || fabs( por ) < 0.01e6 * 1.0e-5 )
dstFrameData[elmNodResIdx] = inf; dstFrameData[elmNodResIdx] = inf;