Skip to content

Commit ae8b01c

Browse files
committed
Adding fallback icon
1 parent 88ef27f commit ae8b01c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed
6.05 KB
Loading

CommunityToolkit.App.Shared/Helpers/IconHelper.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace CommunityToolkit.App.Shared.Helpers;
99
public static class IconHelper
1010
{
1111
internal const string SourceAssetsPrefix = "ms-appx:///SourceAssets/";
12+
internal const string FallBackControlIconPath = "ms-appx:///Assets/ControlIcons/Control.png";
1213

1314
public static IconElement? GetCategoryIcon(ToolkitSampleCategory category)
1415
{
@@ -25,8 +26,15 @@ public static class IconHelper
2526
return iconElement;
2627
}
2728

28-
public static string GetIconPath(string IconPath)
29+
public static string GetIconPath(string? IconPath)
2930
{
30-
return SourceAssetsPrefix + IconPath;
31+
if (!string.IsNullOrEmpty(IconPath))
32+
{
33+
return SourceAssetsPrefix + IconPath;
34+
}
35+
else
36+
{
37+
return FallBackControlIconPath;
38+
}
3139
}
3240
}

0 commit comments

Comments
 (0)