Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs =================================================================== diff -u -r7069 -r7077 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs (.../MacroStabilityCommonHelper.cs) (revision 7069) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs (.../MacroStabilityCommonHelper.cs) (revision 7077) @@ -1,4 +1,4 @@ -// Copyright (C) Stichting Deltares 2025. All rights reserved. +// Copyright (C) Stichting Deltares 2026. All rights reserved. // // This file is part of the Dam Engine. // @@ -583,15 +583,17 @@ xRelevant = surfaceLinePoint.X + 0.001; zRelevant = surfaceLine.Geometry.GetZatX(xRelevant); } + if (i == surfaceLine.Geometry.Points.Count - 1) { xRelevant = surfaceLinePoint.X - 0.001; zRelevant = surfaceLine.Geometry.GetZatX(xRelevant); } + SoilProfile1D geometry1D = soilProfile2D.GetSoilProfile1D(xRelevant); bool profileContainsHole = geometry1D.Layers.Any(layer => layer.Soil == null); // Check if the top layer is generated correctly. - bool topLayerNotGenerated = Math.Abs(geometry1D.TopLevel - zRelevant) > 2 * GeometryConstants.Accuracy; + bool topLayerNotGenerated = Math.Abs(geometry1D.TopLevel - zRelevant) > 2 * GeometryConstants.Accuracy; if (profileContainsHole || topLayerNotGenerated) {