ui nullref fix

This commit is contained in:
Marlon
2022-12-16 19:53:34 +01:00
parent 2fea609a63
commit 352386d1fa
2 changed files with 8 additions and 2 deletions

View File

@@ -63,6 +63,12 @@ public class TabImage : ViewModel
private void SetImage(SKBitmap bitmap)
{
if (bitmap is null)
{
ImageBuffer = null;
Image = null;
return;
}
_bmp = bitmap;
using var data = _bmp.Encode(NoAlpha ? SKEncodedImageFormat.Jpeg : SKEncodedImageFormat.Png, 100);
using var stream = new MemoryStream(ImageBuffer = data.ToArray(), false);
@@ -451,4 +457,4 @@ public class TabControlViewModel : ViewModel
{
yield return new TabItem("New Tab", string.Empty);
}
}
}