diff --git a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C index 7e3850891d248c4510607a386bd44f06ecf8bb5f..0013d193e302f3a839471f515eddf473be7234f5 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C @@ -174,14 +174,17 @@ void Foam::faceZone::checkAddressing() const const labelList& mf = *this; + // Note: nFaces, nCells might not be set yet on mesh so use owner size + const label nFaces = zoneMesh().mesh().faceOwner().size(); + bool hasWarned = false; forAll(mf, i) { - if (!hasWarned && (mf[i] < 0 || mf[i] >= zoneMesh().mesh().nFaces())) + if (!hasWarned && (mf[i] < 0 || mf[i] >= nFaces)) { WarningIn("void Foam::faceZone::checkAddressing() const") << "Illegal face index " << mf[i] << " outside range 0.." - << zoneMesh().mesh().nFaces()-1 << endl; + << nFaces-1 << endl; hasWarned = true; } }