Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingChartDataFactory.cs =================================================================== diff -u -r399dd53d2efa4adb1a3010184e38515b65cef723 -r166f0d43e8e9d8820a7b95503ed2196d0fc54741 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingChartDataFactory.cs (.../PipingChartDataFactory.cs) (revision 399dd53d2efa4adb1a3010184e38515b65cef723) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingChartDataFactory.cs (.../PipingChartDataFactory.cs) (revision 166f0d43e8e9d8820a7b95503ed2196d0fc54741) @@ -161,13 +161,19 @@ /// The which contains the . /// The created . /// Thrown when is null. + /// Thrown when is outside the allowable range of values ([0, number_of_soil_layers>). public static ChartMultipleAreaData CreateSoilLayerChartData(int soilLayerIndex, PipingSoilProfile soilProfile) { if (soilProfile == null) { throw new ArgumentNullException("soilProfile"); } + if (soilLayerIndex < 0 || soilLayerIndex >= soilProfile.Layers.Count()) + { + throw new ArgumentOutOfRangeException("soilLayerIndex"); + } + var soilLayer = soilProfile.Layers.ElementAt(soilLayerIndex); return new ChartMultipleAreaData(string.Format("{0} {1}", soilLayerIndex + 1, soilLayer.MaterialName))