@@ -159,7 +159,8 @@ module.exports = function(RED) {
159159 if ( node . pauseType === "delay" ) {
160160 node . on ( "input" , function ( msg , send , done ) {
161161 var id = ourTimeout ( function ( ) {
162- node . idList . splice ( node . idList . indexOf ( id ) , 1 ) ;
162+ var idx = node . idList . indexOf ( id ) ;
163+ if ( idx !== - 1 ) { node . idList . splice ( idx , 1 ) ; }
163164 if ( node . timeout > 1000 ) {
164165 node . status ( { fill :"blue" , shape :"dot" , text :node . idList . length } ) ;
165166 }
@@ -184,7 +185,8 @@ module.exports = function(RED) {
184185 }
185186 if ( delayvar < 0 ) { delayvar = 0 ; }
186187 var id = ourTimeout ( function ( ) {
187- node . idList . splice ( node . idList . indexOf ( id ) , 1 ) ;
188+ var idx = node . idList . indexOf ( id ) ;
189+ if ( idx !== - 1 ) { node . idList . splice ( idx , 1 ) ; }
188190 if ( node . idList . length === 0 ) { node . status ( { } ) ; }
189191 send ( msg ) ;
190192 if ( delayvar >= 0 ) {
@@ -207,7 +209,8 @@ module.exports = function(RED) {
207209 node . on ( "input" , function ( msg , send , done ) {
208210 var wait = node . randomFirst + ( node . diff * Math . random ( ) ) ;
209211 var id = ourTimeout ( function ( ) {
210- node . idList . splice ( node . idList . indexOf ( id ) , 1 ) ;
212+ var idx = node . idList . indexOf ( id ) ;
213+ if ( idx !== - 1 ) { node . idList . splice ( idx , 1 ) ; }
211214 send ( msg ) ;
212215 if ( node . timeout >= 1000 ) {
213216 node . status ( { fill :"blue" , shape :"dot" , text :node . idList . length } ) ;
0 commit comments