Skip to content

Commit

Permalink
Merge c4a8bc0 into c4a84cc
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianKohler committed Feb 18, 2019
2 parents c4a84cc + c4a8bc0 commit 5cc7893
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/internal/Subscription.ts
Expand Up @@ -130,6 +130,11 @@ export class Subscription implements SubscriptionLike {
*/
add(teardown: TeardownLogic): Subscription {
let subscription = (<Subscription>teardown);

if (!(<any>teardown)) {
return Subscription.EMPTY;
}

switch (typeof teardown) {
case 'function':
subscription = new Subscription(<(() => void)>teardown);
Expand All @@ -147,9 +152,6 @@ export class Subscription implements SubscriptionLike {
}
break;
default: {
if (!(<any>teardown)) {
return Subscription.EMPTY;
}
throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
}
}
Expand Down

0 comments on commit 5cc7893

Please sign in to comment.