mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 01:48:25 +03:00
null check
This commit is contained in:
parent
69eeb8bd23
commit
a75295662c
1 changed files with 9 additions and 2 deletions
|
@ -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.");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue