diff --git a/src/main/java/rx/internal/operators/OperatorPublish.java b/src/main/java/rx/internal/operators/OperatorPublish.java index 662d093ebf..c6739927ee 100644 --- a/src/main/java/rx/internal/operators/OperatorPublish.java +++ b/src/main/java/rx/internal/operators/OperatorPublish.java @@ -535,10 +535,11 @@ void dispatch() { // may contain less than requested int d = 0; while (d < maxRequested) { + term = terminalEvent; Object v = queue.poll(); empty = v == null; // let's check if there is a terminal event and the queue became empty just now - if (checkTerminated(terminalEvent, empty)) { + if (checkTerminated(term, empty)) { skipFinal = true; return; }