Skip to content

Commit d5dc39c

Browse files
albert21wangAHWSWTYCL
authored andcommitted
Fix NPE in FluxWindowTimeout when window is null
Add null check in WindowTimeoutWithBackpressureSubscriber.onNext() to handle hot publishers that emit before downstream request(). Elements are dropped gracefully using Operators.onNextDropped() when window hasn't been created yet, maintaining backpressure semantics. Signed-off-by: AHWSWTYCL <[email protected]>
1 parent 76e4d52 commit d5dc39c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

reactor-core/src/main/java/reactor/core/publisher/FluxWindowTimeout.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ public void onNext(T t) {
184184
}
185185

186186
final InnerWindow<T> window = this.window;
187+
if (window == null) {
188+
Operators.onDiscard(t, this.actual.currentContext());
189+
return;
190+
}
191+
187192
if (window.sendNext(t)) {
188193
return;
189194
}

0 commit comments

Comments
 (0)