diff --git a/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatch/immersedBoundaryFvPatchTriAddressing.C b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatch/immersedBoundaryFvPatchTriAddressing.C index a85e1c516..ca04f0eb1 100644 --- a/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatch/immersedBoundaryFvPatchTriAddressing.C +++ b/src/immersedBoundary/immersedBoundary/immersedBoundaryFvPatch/immersedBoundaryFvPatchTriAddressing.C @@ -86,7 +86,7 @@ void Foam::immersedBoundaryFvPatch::makeTriAddressing() const boolList visited(triPatch.size(), false); - register label curTri; + label curTri = 0; // Only search for tri faces in the mesh forAll (triFacesInMesh, tfimI) @@ -125,13 +125,17 @@ void Foam::immersedBoundaryFvPatch::makeTriAddressing() const // already visited faces do { - curTri = nextToVisit.removeHead(); + if (!nextToVisit.empty()) + { + curTri = nextToVisit.removeHead(); + } + else + { + break; + } } while (visited[curTri]); - // Discard tri if already visited - if (visited[curTri]) continue; - visited[curTri] = true; const triFace& curTriPoints = triPatch[curTri];