Skip to content

Commit 9f2262c

Browse files
committed
fix(common): 解决日期范围解析中的空指针异常
- 在日期范围解析逻辑中添加了空值检查 - 当开始日期或结束日期为空时返回空列表 - 避免了在日期解析失败时可能出现的空指针异常
1 parent 6f11cdc commit 9f2262c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

common/src/main/java/com/tencent/supersonic/common/util/DateUtils.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ public static List<String> getDateList(String startDateStr, String endDateStr,
181181
LocalDate startDate = parseDate(startDateStr);
182182
LocalDate endDate = parseDate(endDateStr);
183183
List<String> datesInRange = new ArrayList<>();
184+
185+
if (startDate == null || endDate == null) {
186+
return datesInRange;
187+
}
188+
184189
LocalDate currentDate = startDate;
185190
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
186191
while (!currentDate.isAfter(endDate)) {

0 commit comments

Comments
 (0)