Index: Ringtoets/Common/src/Ringtoets.Common.IO/DikeProfiles/ProfileLocationReader.cs =================================================================== diff -u -r1b9445050ddc7786014349d7014c7c4d85242a5d -r6be5c7bbb198800d32d85524d0a67ef4a6e1b229 --- Ringtoets/Common/src/Ringtoets.Common.IO/DikeProfiles/ProfileLocationReader.cs (.../ProfileLocationReader.cs) (revision 1b9445050ddc7786014349d7014c7c4d85242a5d) +++ Ringtoets/Common/src/Ringtoets.Common.IO/DikeProfiles/ProfileLocationReader.cs (.../ProfileLocationReader.cs) (revision 6be5c7bbb198800d32d85524d0a67ef4a6e1b229) @@ -149,12 +149,20 @@ private static double GetOffsetAttributeValue(IDictionary attributes) { - var attributeX0Value = attributes[offsetAttributeName] as double?; - if (attributeX0Value == null) + object value = attributes[offsetAttributeName]; + if(value == null) { throw new LineParseException(Resources.ProfileLocationReader_GetProfileLocations_Invalid_X0); } - return attributeX0Value.Value; + + try + { + return Convert.ToDouble(value); + } + catch (Exception e) when (e is FormatException || e is InvalidCastException || e is OverflowException) + { + throw new LineParseException(Resources.ProfileLocationReader_GetProfileLocations_Invalid_X0, e); + } } private static string GetNameAttributeValue(IDictionary attributes)