Fix a possible bug in Task.isWithinPeriod which may be triggered when there are several null values in dateList