File tree Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -50,18 +50,21 @@ export class ParsePushAdapter {
5050 for ( let pushType in deviceMap ) {
5151 let sender = this . senderMap [ pushType ] ;
5252 let devices = deviceMap [ pushType ] ;
53- if ( ! sender ) {
54- log . verbose ( LOG_PREFIX , `Can not find sender for push type ${ pushType } , ${ data } ` )
55- let results = devices . map ( ( device ) => {
56- return Promise . resolve ( {
57- device,
58- transmitted : false ,
59- response : { 'error' : `Can not find sender for push type ${ pushType } , ${ data } ` }
60- } )
61- } ) ;
62- sendPromises . push ( Promise . all ( results ) ) ;
63- } else {
64- sendPromises . push ( sender . send ( data , devices ) ) ;
53+ if ( Array . isArray ( devices ) && devices . length > 0 )
54+ {
55+ if ( ! sender ) {
56+ log . verbose ( LOG_PREFIX , `Can not find sender for push type ${ pushType } , ${ data } ` )
57+ let results = devices . map ( ( device ) => {
58+ return Promise . resolve ( {
59+ device,
60+ transmitted : false ,
61+ response : { 'error' : `Can not find sender for push type ${ pushType } , ${ data } ` }
62+ } )
63+ } ) ;
64+ sendPromises . push ( Promise . all ( results ) ) ;
65+ } else {
66+ sendPromises . push ( sender . send ( data , devices ) ) ;
67+ }
6568 }
6669 }
6770 return Promise . all ( sendPromises ) . then ( ( promises ) => {
You can’t perform that action at this time.
0 commit comments