return done when the collection is empty (#313)

Co-authored-by: Dan Absher <DAbsher@columbiabank.com>
This commit is contained in:
Dandevmt 2020-06-07 05:07:38 -06:00 committed by GitHub
parent 9c4dbad39c
commit 122f5fa454
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,6 +48,11 @@ namespace Elsa.Activities.ControlFlow.Activities
var collection = await expressionEvaluator.EvaluateAsync(CollectionExpression, context, cancellationToken);
var index = CurrentIndex;
if (collection.Count == 0)
{
return Done();
}
if (index >= collection.Count)
{
context.EndScope();