From 6d2a4b73608bff974c53854843a0b28754b18899 Mon Sep 17 00:00:00 2001 From: bemayr Date: Wed, 11 Mar 2020 15:09:52 +0100 Subject: [PATCH] fixed tests --- Statecharts.NET.Core/Parser.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Statecharts.NET.Core/Parser.cs b/Statecharts.NET.Core/Parser.cs index 8f654dc..261f84f 100644 --- a/Statecharts.NET.Core/Parser.cs +++ b/Statecharts.NET.Core/Parser.cs @@ -127,14 +127,15 @@ Service CreateServiceFromActivity(ActivityServiceDefinition service, string id) return new TaskCompletionSource().Task; // TODO: check if token and TaskCompletionSource have to be linked }); - return serviceDefinitions.Select((serviceDefinition, index) => serviceDefinition.Match( + return serviceDefinitions?.Select((serviceDefinition, index) => serviceDefinition.Match( activity => CreateServiceFromActivity(activity, serviceDefinition.GetId(statenode.Id, index)), task => new Service(serviceDefinition.GetId(statenode.Id, index), async cancellationToken => { await task.Task(cancellationToken); return default; }), - dataTask => new Service(serviceDefinition.GetId(statenode.Id, index), dataTask.Task))); + dataTask => new Service(serviceDefinition.GetId(statenode.Id, index), dataTask.Task))) + ?? Enumerable.Empty(); } }