Skip to content

Commit c375315

Browse files
committed
CronExpression.GetFriendlyDescription() should not throw exception when expression is empty
1 parent 2a8f648 commit c375315

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Libraries/SmartStore.Services/Tasks/CronExpression.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,16 @@ public static string GetFriendlyDescription(string expression)
5959
Use24HourTimeFormat = Thread.CurrentThread.CurrentUICulture.DateTimeFormat.AMDesignator.IsEmpty()
6060
};
6161

62-
try
63-
{
64-
return ExpressionDescriptor.GetDescription(expression, options);
65-
}
66-
catch
62+
if (expression.HasValue())
6763
{
68-
return null;
64+
try
65+
{
66+
return ExpressionDescriptor.GetDescription(expression, options);
67+
}
68+
catch { }
6969
}
70+
71+
return "?";
7072
}
7173

7274
}

0 commit comments

Comments
 (0)