From a75295662c94e5130b4b77c21da5dcaccb187443 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 29 Apr 2019 09:59:33 -0400 Subject: [PATCH] null check --- src/App/Utilities/StringHasValueConverter.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/App/Utilities/StringHasValueConverter.cs b/src/App/Utilities/StringHasValueConverter.cs index d21d809a2..0af574ebc 100644 --- a/src/App/Utilities/StringHasValueConverter.cs +++ b/src/App/Utilities/StringHasValueConverter.cs @@ -8,9 +8,16 @@ namespace Bit.App.Utilities public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { - if(targetType == typeof(bool) && value.GetType() == typeof(string)) + if(targetType == typeof(bool)) { - return !string.IsNullOrWhiteSpace((string)value); + if(value == null) + { + return false; + } + if(value.GetType() == typeof(string)) + { + return !string.IsNullOrWhiteSpace((string)value); + } } throw new InvalidOperationException("The value must be a string with a boolean target."); }