You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code consists obvious error: null is passed to switchIfEmpty (actually it's a common mistake to use switchIfEmpty instead of defaultIfEmpty).
But the problem is that the consequent NPE is not emitted to subscribers. Actually, none of the subscirber's methods is called: neither onNext, nor onError or onCompleted. This code does not produce any output to the system.out!
That of course could be fixed by simple null verification on the switchIfEmpty operator creation.
But probably its worth looking more deep into the sequence of producers in this chain, and something could be improved?
This situation caused by the described behavior, when no Observable's events are raised on the event loop, was quite difficult to find and costed us few nervous cells :)