diff --git a/src/Ursa/Controls/ImageViewer/ImageViewer.cs b/src/Ursa/Controls/ImageViewer/ImageViewer.cs index e0abde2..021151f 100644 --- a/src/Ursa/Controls/ImageViewer/ImageViewer.cs +++ b/src/Ursa/Controls/ImageViewer/ImageViewer.cs @@ -163,8 +163,9 @@ public class ImageViewer: TemplatedControl private void OnStretchChanged(AvaloniaPropertyChangedEventArgs args) { + if (_image is null) return; var stretch = args.GetNewValue(); - Scale = GetScaleRatio(Width / _image!.Width, Height / _image!.Height, stretch); + Scale = GetScaleRatio(Width / _image.Width, Height / _image.Height, stretch); _sourceMinScale = _image is not null ? Math.Min(Width * MinScale / _image.Width, Height * MinScale / _image.Height) : MinScale; }