File tree Expand file tree Collapse file tree
packages/transport-commons Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ export class Channel extends EventEmitter {
4343
4444 join ( ...connections : RealTimeConnection [ ] ) {
4545 connections . forEach ( connection => {
46- if ( this . connections . indexOf ( connection ) === - 1 ) {
46+ if ( connection && this . connections . indexOf ( connection ) === - 1 ) {
4747 this . connections . push ( connection ) ;
4848 }
4949 } ) ;
Original file line number Diff line number Diff line change @@ -48,8 +48,7 @@ export class CombinedChannel extends Channel {
4848 }
4949
5050 private callChildren ( method : string , connections : RealTimeConnection [ ] ) {
51- // @ts -ignore
52- this . children . forEach ( child => child [ method ] ( ...connections ) ) ;
51+ this . children . forEach ( ( child : any ) => child [ method ] ( ...connections ) ) ;
5352 this . refresh ( ) ;
5453
5554 return this ;
Original file line number Diff line number Diff line change @@ -181,6 +181,12 @@ describe('app.channel', () => {
181181 assert . strictEqual ( combined . length , 2 ) ;
182182 } ) ;
183183
184+ it ( 'does nothing when the channel is undefined (#2207)' , ( ) => {
185+ const channel = app . channel ( 'test' , 'me' ) ;
186+
187+ channel . join ( undefined ) ;
188+ } ) ;
189+
184190 it ( '.join all child channels' , ( ) => {
185191 const c1 = { id : 1 } ;
186192 const c2 = { id : 2 } ;
You can’t perform that action at this time.
0 commit comments