Index: src/Deltares.DSoilModel.Forms/DSoilModelGeometryEditor.cs =================================================================== diff -u -r638 -r642 --- src/Deltares.DSoilModel.Forms/DSoilModelGeometryEditor.cs (.../DSoilModelGeometryEditor.cs) (revision 638) +++ src/Deltares.DSoilModel.Forms/DSoilModelGeometryEditor.cs (.../DSoilModelGeometryEditor.cs) (revision 642) @@ -489,19 +489,19 @@ private void DataEventPublisherOnOnAfterChange(object sender, PublishEventArgs publishEventArgs) { - if (sender is CenterCrestLocation) + var ccl = sender as CenterCrestLocation; + if (ccl != null) { - var ccl = sender as CenterCrestLocation; - if (ccl.SoilProfile2D.CenterCrestLocation != ccl.Location && !(double.IsNaN(ccl.SoilProfile2D.CenterCrestLocation) + if (Math.Abs(ccl.SoilProfile2D.CenterCrestLocation - ccl.Location) > double.Epsilon && !(double.IsNaN(ccl.SoilProfile2D.CenterCrestLocation) && double.IsNaN(ccl.Location))) { ccl.SoilProfile2D.CenterCrestLocation = ccl.Location; }; } - - if (sender is SoilProfile2D) + + var soilProfile2D = sender as SoilProfile2D; + if (soilProfile2D != null) { - var soilProfile2D = sender as SoilProfile2D; if (publishEventArgs.Property == soilProfile2D.GetMemberName(x => x.CenterCrestLocation)) { if (localCenterCrestLocation == null && !double.IsNaN(soilProfile2D.CenterCrestLocation)) @@ -513,8 +513,8 @@ } if (localCenterCrestLocation != null && Object.ReferenceEquals(localCenterCrestLocation.SoilProfile2D, soilProfile2D) && - (Math.Abs(localCenterCrestLocation.Location - soilProfile2D.CenterCrestLocation) > double.Epsilon) || - double.IsNaN(localCenterCrestLocation.Location) || double.IsNaN(soilProfile2D.CenterCrestLocation)) + (Math.Abs(localCenterCrestLocation.Location - soilProfile2D.CenterCrestLocation) > double.Epsilon || + double.IsNaN(localCenterCrestLocation.Location) || double.IsNaN(soilProfile2D.CenterCrestLocation))) { localCenterCrestLocation.Location = soilProfile2D.CenterCrestLocation; DataEventPublisherOnSelectionChanged(localCenterCrestLocation, null);