@@ -382,12 +382,16 @@ export default class StepFunctionsOfflinePlugin implements Plugin {
382382 }
383383 }
384384
385- _handleMap ( currentState : Map ) : StateValueReturn {
385+ _handleMap ( currentState : Map , stateName : string ) : StateValueReturn {
386386 return {
387387 f : ( event : Event ) : Promise < void | AsyncCallback > => {
388388 const items = _ . get ( event , currentState . ItemsPath ?. replace ( / ^ \$ \. / , '' ) ?? '' , [ ] ) ;
389389 const mapItems : unknown [ ] = _ . clone ( items ) ;
390390 this . mapResults = [ ] ;
391+ if ( mapItems . length === 0 ) {
392+ this . cliLog ( `State ${ stateName } is being called with no items, skipping...` ) ;
393+ if ( currentState . End ) return Promise . resolve ( ) ;
394+ }
391395
392396 const processNextItem = ( ) : Promise < void > => {
393397 const item = mapItems . shift ( ) ;
@@ -429,7 +433,7 @@ export default class StepFunctionsOfflinePlugin implements Plugin {
429433 if ( currentState . Next ) {
430434 await this . process ( this . states [ currentState . Next ] , currentState . Next , event ) ;
431435 }
432- return Promise . resolve ( ) ;
436+ return ;
433437 } ) ;
434438 } ,
435439 } ;
@@ -540,7 +544,7 @@ export default class StepFunctionsOfflinePlugin implements Plugin {
540544
541545 _states ( currentState : State , currentStateName : string ) : StateValueReturn {
542546 if ( isType ( 'Map' ) < Map > ( currentState ) ) {
543- return this . _handleMap ( currentState ) ;
547+ return this . _handleMap ( currentState , currentStateName ) ;
544548 }
545549 if ( isType ( 'Task' ) < Task > ( currentState ) ) {
546550 return this . _handleTask ( currentState , currentStateName ) ;
0 commit comments