From f78cf5afb70cea7eb581c2abd0bae13c5515f861 Mon Sep 17 00:00:00 2001 From: ClemensFischer Date: Fri, 18 Aug 2023 07:03:52 +0200 Subject: [PATCH] Update ImageLoader.WinUI.cs --- MapControl/WinUI/ImageLoader.WinUI.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/MapControl/WinUI/ImageLoader.WinUI.cs b/MapControl/WinUI/ImageLoader.WinUI.cs index 2f8bd881..e230f4fe 100644 --- a/MapControl/WinUI/ImageLoader.WinUI.cs +++ b/MapControl/WinUI/ImageLoader.WinUI.cs @@ -93,10 +93,11 @@ namespace MapControl } var images = await Task.WhenAll(LoadImageAsync(uri1, progress1), LoadImageAsync(uri2, progress2)); - var image1 = (WriteableBitmap)images[0]; - var image2 = (WriteableBitmap)images[1]; - if (image1.PixelHeight == image2.PixelHeight) + if (images.Length == 2 && + images[0] is WriteableBitmap image1 && + images[1] is WriteableBitmap image2 && + image1.PixelHeight == image2.PixelHeight) { var width = image1.PixelWidth + image2.PixelWidth; var height = image2.PixelHeight;