From c91821cacf9cf5e5cd6bc6480ce4cffe523676d8 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Thu, 29 Oct 2020 21:36:13 +0100 Subject: [PATCH] Default to first activity as starter --- src/core/Elsa.Core/Services/WorkflowRunner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/Elsa.Core/Services/WorkflowRunner.cs b/src/core/Elsa.Core/Services/WorkflowRunner.cs index 0584c1b71..3eccb1159 100644 --- a/src/core/Elsa.Core/Services/WorkflowRunner.cs +++ b/src/core/Elsa.Core/Services/WorkflowRunner.cs @@ -172,7 +172,7 @@ namespace Elsa.Services private async Task BeginWorkflow(WorkflowExecutionContext workflowExecutionContext, IActivityBlueprint? activity, object? input, CancellationToken cancellationToken) { if (activity == null) - activity = workflowExecutionContext.WorkflowBlueprint.GetStartActivities().First(); + activity = workflowExecutionContext.WorkflowBlueprint.GetStartActivities().FirstOrDefault() ?? workflowExecutionContext.WorkflowBlueprint.Activities.First(); if (!await CanExecuteAsync(workflowExecutionContext, activity, input, cancellationToken)) return;