File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -279,16 +279,19 @@ class _ClientImpl {
279279 this . debug !== false &&
280280 this . _debugPanel == null
281281 ) {
282- let target = document . body ;
283- if ( this . debug && this . debug . target ) {
282+ let target = document && document . body ;
283+ if ( this . debug && this . debug . target !== undefined ) {
284284 target = this . debug . target ;
285285 }
286- this . _debugPanel = new debugImpl ( {
287- target,
288- props : {
289- client : this ,
290- } ,
291- } ) ;
286+
287+ if ( target ) {
288+ this . _debugPanel = new debugImpl ( {
289+ target,
290+ props : {
291+ client : this ,
292+ } ,
293+ } ) ;
294+ }
292295 }
293296 }
294297
Original file line number Diff line number Diff line change @@ -642,6 +642,13 @@ describe('start / stop', () => {
642642 client . stop ( ) ;
643643 } ) ;
644644
645+ test ( 'no error when mounting on null element' , ( ) => {
646+ const client = Client ( { game : { } , debug : { target : null } } ) ;
647+ client . start ( ) ;
648+ client . stop ( ) ;
649+ expect ( client . _debugPanel ) . toBe ( null ) ;
650+ } ) ;
651+
645652 test ( 'override debug implementation' , ( ) => {
646653 const client = Client ( { game : { } , debug : { impl : Debug } } ) ;
647654 client . start ( ) ;
You can’t perform that action at this time.
0 commit comments