Skip to content

2.x: Correctly dereference subscription before comparing against null. #4382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/io/reactivex/observers/TestObserver.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public final int errorCount() {
* @return true if this TestSubscriber received a subscription
*/
public final boolean hasSubscription() {
return subscription != null;
return subscription.get() != null;
}

/**
Expand Down Expand Up @@ -577,7 +577,7 @@ public final TestObserver<T> assertNotTerminated() {
* @return this;
*/
public final TestObserver<T> assertSubscribed() {
if (subscription == null) {
if (subscription.get() == null) {
fail("Not subscribed!");
}
return this;
Expand All @@ -588,7 +588,7 @@ public final TestObserver<T> assertSubscribed() {
* @return this;
*/
public final TestObserver<T> assertNotSubscribed() {
if (subscription != null) {
if (subscription.get() != null) {
fail("Subscribed!");
} else
if (!errors.isEmpty()) {
Expand Down