Skip to content

Commit 14fcc22

Browse files
committed
Use unsubscribed check instead of a null check.
1 parent 224cafb commit 14fcc22

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/rx/subscriptions/CompositeSubscription.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Copyright 2014 Netflix, Inc.
3-
*
3+
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
7+
*
88
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
9+
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -55,8 +55,8 @@ public synchronized boolean isUnsubscribed() {
5555
* the {@link Subscription} to add
5656
*/
5757
public void add(final Subscription s) {
58-
if (s == null) {
59-
throw new NullPointerException("Added Subscription cannot be null.");
58+
if (s.isUnsubscribed()) {
59+
return;
6060
}
6161
Subscription unsubscribe = null;
6262
synchronized (this) {

0 commit comments

Comments
 (0)