Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxymGorn committed Nov 13, 2023
1 parent 7cde09f commit 8d141ff
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public static string PresentDefaultValue(this object value)
{
return "null";
}

Type type = value.GetType();

if (type == typeof(string))
Expand All @@ -144,14 +145,32 @@ public static string PresentDefaultValue(this object value)
return $"\"{value}\"";
}
}

if (type.IsEnum)
{
return $"{type.Name}.{value}";
}

if (Nullable.GetUnderlyingType(type) != null)
{
return _converter.Set(value);

Check warning on line 156 in src/Cropper.Blazor/Cropper.Blazor.Shared/Extensions/MethodInfoExtensions.cs

View workflow job for this annotation

GitHub Actions / Build & Test

Possible null reference return.
}

if (type.IsGenericType) // for instance event callbacks
{
return "";
}

if (type.IsValueType)
{
return _converter.Set(value);

Check warning on line 166 in src/Cropper.Blazor/Cropper.Blazor.Shared/Extensions/MethodInfoExtensions.cs

View workflow job for this annotation

GitHub Actions / Build & Test

Possible null reference return.
}

if (type.IsClass)
{
return type.Name;
}

return "";
}

Expand Down

0 comments on commit 8d141ff

Please sign in to comment.