Fix for Scheduled Jobs UI #5354
This PR addresses an issue where null date/time values could cause exceptions when processing job scheduling. Changes Made: - Added proper null checks for _startDate, _startTime, _endDate, _endTime, _nextDate, and _nextTime - Improved parsing safety for _retentionHistory using int.TryParse() - Added validation to fail early with meaningful error messages Impact: Prevents NullReferenceException and InvalidOperationException when date/time fields are missing
This commit is contained in:
@ -176,10 +176,18 @@
|
|||||||
{
|
{
|
||||||
job.Interval = int.Parse(_interval);
|
job.Interval = int.Parse(_interval);
|
||||||
}
|
}
|
||||||
job.StartDate = LocalToUtc(_startDate.Value.Date.Add(_startTime.Value.TimeOfDay));
|
job.StartDate = _startDate.HasValue && _startTime.HasValue
|
||||||
job.EndDate = LocalToUtc(_endDate.Value.Date.Add(_endTime.Value.TimeOfDay));
|
? LocalToUtc(_startDate.Value.Date.Add(_startTime.Value.TimeOfDay))
|
||||||
job.RetentionHistory = int.Parse(_retentionHistory);
|
: null;
|
||||||
job.NextExecution = LocalToUtc(_nextDate.Value.Date.Add(_nextTime.Value.TimeOfDay));
|
|
||||||
|
job.EndDate = _endDate.HasValue && _endTime.HasValue
|
||||||
|
? LocalToUtc(_endDate.Value.Date.Add(_endTime.Value.TimeOfDay))
|
||||||
|
: null;
|
||||||
|
|
||||||
|
job.NextExecution = _nextDate.HasValue && _nextTime.HasValue
|
||||||
|
? LocalToUtc(_nextDate.Value.Date.Add(_nextTime.Value.TimeOfDay))
|
||||||
|
: null;
|
||||||
|
job.RetentionHistory = int.Parse(_retentionHistory);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user