#2067 NNC : Guard before accessing values

This commit is contained in:
Magne Sjaastad 2017-10-31 10:22:20 +01:00
parent dbc401ef71
commit 6aaa8f7606
2 changed files with 4 additions and 4 deletions

View File

@ -169,7 +169,7 @@ void RivNNCGeometryGenerator::textureCoordinates(cvf::Vec2fArray* textureCoords,
nncResultVals = m_nncData->generatedConnectionScalarResult(scalarResultIndex, nativeTimeStepIndex);
}
if (!nncResultVals)
if (!nncResultVals || nncResultVals->size() == 0)
{
textureCoords->setAll(cvf::Vec2f(0.0f, 1.0f));
return;

View File

@ -340,7 +340,7 @@ QString RiuResultTextBuilder::nncResultText()
RigNNCData* nncData = grid->nncData();
CVF_ASSERT(nncData);
if (nncData)
if (nncData && m_nncIndex < nncData->connections().size())
{
const RigConnection& conn = nncData->connections()[m_nncIndex];
cvf::StructGridInterface::FaceEnum face(conn.m_c1Face);
@ -362,7 +362,7 @@ QString RiuResultTextBuilder::nncResultText()
nncValues = nncData->dynamicConnectionScalarResult(scalarResultIdx, nativeTimeStep);
}
}
if (nncValues)
if (nncValues && (m_nncIndex < nncValues->size()))
{
QString resultVar = m_reservoirView->currentFaultResultColors()->resultVariableUiName();
double scalarValue = (*nncValues)[m_nncIndex];
@ -585,7 +585,7 @@ QString RiuResultTextBuilder::nncDetails()
RigNNCData* nncData = grid->nncData();
CVF_ASSERT(nncData);
if (nncData)
if (nncData && m_nncIndex < nncData->connections().size())
{
text += "-- NNC details --\n";
{