File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
main/java/rx/subscriptions
test/java/rx/subscriptions Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1
1
/**
2
2
* Copyright 2014 Netflix, Inc.
3
- *
3
+ *
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
6
6
* You may obtain a copy of the License at
7
- *
7
+ *
8
8
* http://www.apache.org/licenses/LICENSE-2.0
9
- *
9
+ *
10
10
* Unless required by applicable law or agreed to in writing, software
11
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -55,6 +55,9 @@ public synchronized boolean isUnsubscribed() {
55
55
* the {@link Subscription} to add
56
56
*/
57
57
public void add (final Subscription s ) {
58
+ if (s .isUnsubscribed ()) {
59
+ return ;
60
+ }
58
61
Subscription unsubscribe = null ;
59
62
synchronized (this ) {
60
63
if (unsubscribed ) {
Original file line number Diff line number Diff line change @@ -337,4 +337,11 @@ public void testTryRemoveIfNotIn() {
337
337
338
338
csub .remove (csub1 ); // try removing agian
339
339
}
340
+
341
+ @ Test (expected = NullPointerException .class )
342
+ public void testAddingNullSubscriptionIllegal () {
343
+ CompositeSubscription csub = new CompositeSubscription ();
344
+ csub .add (null );
345
+ }
346
+
340
347
}
You can’t perform that action at this time.
0 commit comments