File tree Expand file tree Collapse file tree
main/java/rx/subscriptions
test/java/rx/subscriptions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ 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 IllegalArgumentException ("Added Subscription cannot be null." );
60+ }
5861 Subscription unsubscribe = null ;
5962 synchronized (this ) {
6063 if (unsubscribed ) {
Original file line number Diff line number Diff line change @@ -337,4 +337,11 @@ public void testTryRemoveIfNotIn() {
337337
338338 csub .remove (csub1 ); // try removing agian
339339 }
340+
341+ @ Test (expected = IllegalArgumentException .class )
342+ public void testAddingNullSubscriptionIllegal () {
343+ CompositeSubscription csub = new CompositeSubscription ();
344+ csub .add (null );
345+ }
346+
340347}
You can’t perform that action at this time.
0 commit comments