From 5e0a8b44c42fc47a843e054b0486e1ed0b34f27a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=AB=98?= <171376172@qq.com> Date: Thu, 6 Jun 2024 10:01:47 +0000 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=8C=87=E5=AE=9A=E6=9F=90=E4=B8=80?= =?UTF-8?q?=E5=B9=B4=E6=89=A7=E8=A1=8C=E6=97=B6=EF=BC=8C=E5=8F=AA=E4=BC=9A?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E4=B8=80=E6=AC=A1=EF=BC=8C=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E4=BB=BB=E5=8A=A1=E8=AF=A6=E7=BB=86=E4=BC=9A?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 高高 <171376172@qq.com> --- .../iocoder/yudao/framework/quartz/core/util/CronUtils.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/util/CronUtils.java b/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/util/CronUtils.java index 9b5a2bff7..a97a8e1eb 100644 --- a/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/util/CronUtils.java +++ b/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/util/CronUtils.java @@ -46,6 +46,10 @@ public class CronUtils { List nextTimes = new ArrayList<>(n); for (int i = 0; i < n; i++) { Date nextTime = cron.getNextValidTimeAfter(now); + if (nextTime == null) { + // 如果 nextTime 为 null,说明没有更多的有效时间,退出循环 + break; + } nextTimes.add(LocalDateTimeUtil.of(nextTime)); // 切换现在,为下一个触发时间; now = nextTime;