Skip to content

Commit 40ad57c

Browse files
JakeWhartonakarnokd
authored andcommitted
Correctly dereference subscription before comparing against null. (#4382)
1 parent f738a85 commit 40ad57c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/io/reactivex/observers/TestObserver.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public final int errorCount() {
248248
* @return true if this TestSubscriber received a subscription
249249
*/
250250
public final boolean hasSubscription() {
251-
return subscription != null;
251+
return subscription.get() != null;
252252
}
253253

254254
/**
@@ -577,7 +577,7 @@ public final TestObserver<T> assertNotTerminated() {
577577
* @return this;
578578
*/
579579
public final TestObserver<T> assertSubscribed() {
580-
if (subscription == null) {
580+
if (subscription.get() == null) {
581581
fail("Not subscribed!");
582582
}
583583
return this;
@@ -588,7 +588,7 @@ public final TestObserver<T> assertSubscribed() {
588588
* @return this;
589589
*/
590590
public final TestObserver<T> assertNotSubscribed() {
591-
if (subscription != null) {
591+
if (subscription.get() != null) {
592592
fail("Subscribed!");
593593
} else
594594
if (!errors.isEmpty()) {

0 commit comments

Comments
 (0)