Skip to content

Commit 06d263e

Browse files
committed
Avoids null reference exception
Prevents a null reference exception when the embedded image name is empty. - Checks for null or empty embedded image names before attempting to load the resource. - Returns early if the image name is invalid, preventing a crash.
1 parent aa99d9e commit 06d263e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

AuroraControlsMaui/SvgImageView.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ private void SetSvgResource()
170170
{
171171
string embeddedImageName = EmbeddedImageName;
172172

173+
if (string.IsNullOrEmpty(embeddedImageName))
174+
{
175+
return;
176+
}
177+
173178
lock (_pictureLock)
174179
{
175180
using var imageStream = EmbeddedResourceLoader.Load(embeddedImageName);

AuroraControlsMaui/Tile.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,11 @@ private void SetSvgResource()
727727
{
728728
string embeddedImageName = EmbeddedImageName;
729729

730+
if (string.IsNullOrEmpty(embeddedImageName))
731+
{
732+
return;
733+
}
734+
730735
lock (_pictureLock)
731736
{
732737
using var imageStream = EmbeddedResourceLoader.Load(embeddedImageName);

0 commit comments

Comments
 (0)