File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
main/java/rx/subscriptions
test/java/rx/subscriptions Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -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 == null ) {
59
+ throw new IllegalArgumentException ("Added Subscription cannot be null." );
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 = IllegalArgumentException .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