title: RxJava Can subscribe() on an Observable.empty() call onComplete() before the onSubscribe() returns a Subscription causing a NullPointerException?
body: <p>I am writing to logic that merges two Observables together so that I can make sure they both run together and complete a whole. To do this, I have used the <code>Observable.mergeDelayError()</code> as seen below. However, when I am writing my unit tests, sometimes, I get a <code>NullPointerException</code> when trying to call <code>mRefreshSubscription.unsubscribe()</code> where <code>mRefreshSubscription</code> is null. </p>
  
  <p>Question:
  Is it possible that the resulting merged Observable, because it can be double empty, proceed to call into <code>onComplete()</code> faster than <code>subscribe()</code> returns a subscription?</p>
  
  <pre><code>Observable observA = Observable.empty();
  Observable observB = Observable.empty();
  
  mRefreshSubscription = Observable.mergeDelayError(observA, observB)
                  .subscribeOn(Schedulers.io())
                  .observeOn(Schedulers.io())
                  .subscribe(getRefreshObserver());
  
  private Observer getRefreshObserver() {
      if (mRefreshObserver == null) {
          mRefreshObserver = new Observer() {
              @Override
              public void onCompleted() {
                  mRefreshSubscription.unsubscribe();
              }
  
              @Override
              public void onError(Throwable e) {
                  mRefreshSubscription.unsubscribe();
              }
  
              @Override
              public void onNext(Object o) {
                  // do nothing
              }
          };
      }
      return mCleanAndAutoSubscriberObserver;
  }
  </code></pre>