Skip to content

Commit 108872a

Browse files
CodeCasterXclaude
andcommitted
fix: 修复 To.java 中 peekedToken 可能为 null 的问题
在并发场景下,window.peekAndConsume() 可能返回 null, 导致后续调用 peekedToken.finishConsume() 时抛出 NPE。 添加 null 检查以防止此类错误。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 00337d9 commit 108872a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • framework/waterflow/java/waterflow-core/src/main/java/modelengine/fit/waterflow/domain/stream/nodes

framework/waterflow/java/waterflow-core/src/main/java/modelengine/fit/waterflow/domain/stream/nodes/To.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,9 @@ public <T1, R1> List<FlowContext<R1>> process(To<T1, R1> to, List<FlowContext<T1
937937
nextSession.getWindow().complete();
938938
}
939939
} else {
940-
peekedToken.finishConsume();
940+
if (peekedToken != null) {
941+
peekedToken.finishConsume();
942+
}
941943
if (window.isDone()) {
942944
window.tryFinish();
943945
}

0 commit comments

Comments
 (0)