Image buffer null and length check

This commit is contained in:
ClemensFischer 2025-09-01 12:04:36 +02:00
parent ec53c50c67
commit 7846f4f685
2 changed files with 2 additions and 3 deletions

View file

@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.IO;
using System.Threading.Tasks;
#if WPF
using System.Windows.Media;
@ -73,7 +72,7 @@ namespace MapControl.MBTiles
var buffer = (byte[])await command.ExecuteScalarAsync();
if (buffer != null && buffer.Length > 0)
if (buffer?.Length > 0)
{
image = await LoadImageAsync(buffer);
}

View file

@ -173,7 +173,7 @@ namespace MapControl
{
var buffer = await LoadCachedBuffer(tile, uri, cacheName).ConfigureAwait(false);
if (buffer != null && buffer.Length > 0)
if (buffer?.Length > 0)
{
Task<ImageSource> LoadImage() => tileSource.LoadImageAsync(buffer);