From 9efb15606af8f6246488d2f8e7047220a1db9633 Mon Sep 17 00:00:00 2001 From: Manuel Koetter Date: Fri, 11 Jan 2019 11:19:52 +0700 Subject: [PATCH] Reverted behavior of FindIconForKey back to return null whenever no suitable icon can be provided for whatever reason as throwing an exception without also adapting the renderers breaks things for virtually everyone who uses data binding as can be seen in #119 and #28 --- src/Plugin.Iconize/Iconize.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Plugin.Iconize/Iconize.cs b/src/Plugin.Iconize/Iconize.cs index ac0afe1..e4cec35 100644 --- a/src/Plugin.Iconize/Iconize.cs +++ b/src/Plugin.Iconize/Iconize.cs @@ -125,13 +125,10 @@ public static IIconModule FindModuleOf(IIcon icon) /// The icon, or null if no icon matches the key public static IIcon FindIconForKey(String iconKey) { - if (iconKey is null) - throw new ArgumentNullException(nameof(iconKey)); - if (String.IsNullOrWhiteSpace(iconKey)) - throw new ArgumentException($"{nameof(iconKey)} cannot be empty", nameof(iconKey)); + return null; - return Modules?.FirstOrDefault(x => x.Keys.Contains(iconKey))?.GetIcon(iconKey) ?? throw new NullReferenceException($"No icon with the key: {iconKey}"); + return Modules?.FirstOrDefault(x => x.Keys.Contains(iconKey))?.GetIcon(iconKey); } } } \ No newline at end of file