diff --git a/src/Engine/Draw/Images/LoadedImageSource.cs b/src/Engine/Draw/Images/LoadedImageSource.cs index 7e6c240e..d7ac8043 100644 --- a/src/Engine/Draw/Images/LoadedImageSource.cs +++ b/src/Engine/Draw/Images/LoadedImageSource.cs @@ -115,25 +115,28 @@ public SKBitmap Bitmap get => _bitmap; set { - _bitmap = value; - if (_bitmap == null) + if (!IsDisposed) { - if (_image == null) + _bitmap = value; + if (_bitmap == null) { - _height = 0; - _width = 0; + if (_image == null) + { + _height = 0; + _width = 0; + } + else + { + _height = _image.Height; + _width = _image.Width; + } } else { - _height = _image.Height; - _width = _image.Width; + _height = _bitmap.Height; + _width = _bitmap.Width; } } - else - { - _height = _bitmap.Height; - _width = _bitmap.Width; - } } } @@ -142,21 +145,24 @@ public SKImage Image get => _image; set { - _image = value; - if (_image == null) + if (!IsDisposed) { - if (_bitmap == null) + _image = value; + if (_image == null) { - _height = 0; - _width = 0; + if (_bitmap == null) + { + _height = 0; + _width = 0; + } } - } - else - { - if (_bitmap == null) + else { - _height = _image.Height; - _width = _image.Width; + if (_bitmap == null) + { + _height = _image.Height; + _width = _image.Width; + } } } }