File tree Expand file tree Collapse file tree 1 file changed +16
-16
lines changed Expand file tree Collapse file tree 1 file changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -50,22 +50,22 @@ export class ParsePushAdapter {
5050 for ( let pushType in deviceMap ) {
5151 let sender = this . senderMap [ pushType ] ;
5252 let devices = deviceMap [ pushType ] ;
53- if ( 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- }
68- }
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+ }
68+ }
6969 }
7070 return Promise . all ( sendPromises ) . then ( ( promises ) => {
7171 // flatten all
You can’t perform that action at this time.
0 commit comments