BUG: invalid pointer reference for optional coordinate system lookup

- code remnant from separate lookup + construct of coordinateSystem
  (7b2bcfda0b).
  Apply consistent use of coordinateSystem::NewIfPresent to avoid
  these types of coding mishaps
This commit is contained in:
Mark Olesen
2022-10-06 12:49:23 +02:00
parent 793433da72
commit bcd461926c
4 changed files with 24 additions and 54 deletions

View File

@ -84,14 +84,12 @@ void Foam::geomDecomp::readCoeffs()
}
setOrder();
// Optional cartesian coordinate system transform
const dictionary* dictptr =
coeffsDict_.findDict("transform", keyType::LITERAL);
// Optional (cartesian) coordinate system transform
auto csysPtr = coordinateSystem::NewIfPresent(coeffsDict_, "transform");
if (dictptr)
if (csysPtr)
{
// 'origin' (READ_IF_PRESENT)
csys_ = coordinateSystem(*dictptr, IOobjectOption::READ_IF_PRESENT);
csys_ = csysPtr();
}
else if (equal(delta_, 0))
{