From 054def3d13bab82d2459b73e30243e22e44f7831 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 7 Aug 2021 16:46:39 +0200 Subject: [PATCH] Fix crash in build tool if there is no valid project to pick --- .../VisualStudioCode/VisualStudioCodeProjectGenerator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs index 2d188d266..77d34c1d7 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs @@ -404,8 +404,9 @@ namespace Flax.Build.Projects.VisualStudioCode json.BeginRootObject(); json.BeginArray("configurations"); json.BeginObject(); + var project = solution.MainProject ?? solution.Projects.FirstOrDefault(x => x.Name == Globals.Project.Name); + if (project != null) { - var project = solution.MainProject ?? solution.Projects.First(x => x.Name == Globals.Project.Name); json.AddField("name", project.Name); var targetPlatform = Platform.BuildPlatform.Target;