Skip to content

Commit

Permalink
Null handling for dates
Browse files Browse the repository at this point in the history
  • Loading branch information
JW-CH committed Dec 5, 2024
1 parent 852f853 commit 40b05ee
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ImmichFrame.WebApi/Helpers/SettingsExtensonMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private static void SetValue(object settings, PropertyInfo prop, string value)
}
else if (type == typeof(int) || type == typeof(int?))
{
if (value == null) return;
if (string.IsNullOrEmpty(value)) return;

prop.SetValue(settings, Convert.ToInt32(value));
}
Expand All @@ -57,6 +57,8 @@ private static void SetValue(object settings, PropertyInfo prop, string value)
}
else if (type == typeof(DateTime) || type == typeof(DateTime?))
{
if (string.IsNullOrEmpty(value)) return;

prop.SetValue(settings, Convert.ToDateTime(value));
}
else
Expand Down

0 comments on commit 40b05ee

Please sign in to comment.