diff --git a/CPAP-Exporter.UI/ToggleSwitch.xaml.cs b/CPAP-Exporter.UI/ToggleSwitch.xaml.cs index 3e8ecc3..5f27285 100644 --- a/CPAP-Exporter.UI/ToggleSwitch.xaml.cs +++ b/CPAP-Exporter.UI/ToggleSwitch.xaml.cs @@ -230,6 +230,11 @@ public Brush KnobDisabledBackgroundBrush private void AnimateKnob(bool isChecked) { + if (this.knob is null) + { + return; + } + double margin = this.knob.Margin.Left + this.knob.Margin.Right; double travelDistance = this.track.ActualWidth - this.knob.ActualWidth - margin;