-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Closed
Milestone
Description
We're seeing an NPE from the s field of SerializedObserver not being set when used with .withLatestFrom(). Digging around in the source, it looks like it internally is not calling onSubscribe() to the actual observer field.
Example trace looks like this:
java.lang.NullPointerException
at io.reactivex.observers.SerializedObserver.onNext(SerializedObserver.java:91)
at io.reactivex.internal.operators.observable.ObservableWithLatestFrom$WithLatestFromObserver.onNext(ObservableWithLatestFrom.java:101)
at io.reactivex.internal.operators.observable.ObservableFilter$FilterObserver.onNext(ObservableFilter.java:51)
at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:63)
at io.reactivex.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:263)
at io.reactivex.subjects.PublishSubject.onNext(PublishSubject.java:182)
The snippet in SerializedObserver that corresponds to
@Override
public void onNext(T t) {
if (done) {
return;
}
if (t == null) {
s.dispose(); // <----- this line, "s" is null because onSubscribe was never called
onError(new NullPointerException("onNext called with null. Null values are generally not allowed in 2.x operators and sources."));
return;
}Reactions are currently unavailable