@@ -375,12 +375,16 @@ export default class StepFunctionsOfflinePlugin implements Plugin {
375375 }
376376 }
377377
378- _handleMap ( currentState : Map ) : StateValueReturn {
378+ _handleMap ( currentState : Map , stateName : string ) : StateValueReturn {
379379 return {
380380 f : ( event : Event ) : Promise < void | AsyncCallback > => {
381381 const items = _ . get ( event , currentState . ItemsPath ?. replace ( / ^ \$ \. / , '' ) ?? '' , [ ] ) ;
382382 const mapItems : unknown [ ] = _ . clone ( items ) ;
383383 this . mapResults = [ ] ;
384+ if ( mapItems . length === 0 ) {
385+ this . cliLog ( `State ${ stateName } is being called with no items, skipping...` ) ;
386+ if ( currentState . End ) return Promise . resolve ( ) ;
387+ }
384388
385389 const processNextItem = ( ) : Promise < void > => {
386390 const item = mapItems . shift ( ) ;
@@ -422,7 +426,7 @@ export default class StepFunctionsOfflinePlugin implements Plugin {
422426 if ( currentState . Next ) {
423427 await this . process ( this . states [ currentState . Next ] , currentState . Next , event ) ;
424428 }
425- return Promise . resolve ( ) ;
429+ return ;
426430 } ) ;
427431 } ,
428432 } ;
@@ -533,7 +537,7 @@ export default class StepFunctionsOfflinePlugin implements Plugin {
533537
534538 _states ( currentState : State , currentStateName : string ) : StateValueReturn {
535539 if ( isType ( 'Map' ) < Map > ( currentState ) ) {
536- return this . _handleMap ( currentState ) ;
540+ return this . _handleMap ( currentState , currentStateName ) ;
537541 }
538542 if ( isType ( 'Task' ) < Task > ( currentState ) ) {
539543 return this . _handleTask ( currentState , currentStateName ) ;
0 commit comments