From 5cb57c87bd6e1eaae490a198e15495d43ff7df2e Mon Sep 17 00:00:00 2001 From: Roberto T <61755417+RobertGlobant20@users.noreply.github.com> Date: Tue, 28 May 2024 07:14:54 -0700 Subject: [PATCH] DYN-6995 Crash When Changing Language (#15254) --- .../DocumentationBrowserViewExtension.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/DocumentationBrowserViewExtension/DocumentationBrowserViewExtension.cs b/src/DocumentationBrowserViewExtension/DocumentationBrowserViewExtension.cs index 3934a1c6377..c38ce5a36c8 100644 --- a/src/DocumentationBrowserViewExtension/DocumentationBrowserViewExtension.cs +++ b/src/DocumentationBrowserViewExtension/DocumentationBrowserViewExtension.cs @@ -251,7 +251,14 @@ private void GroupInsertedGraph(List existingGroups, string var annotationViewModel = DynamoViewModel.CurrentSpaceViewModel.Annotations .First(x => x.AnnotationModel == annotation); - var styleItem = annotationViewModel.GroupStyleList.First(x => x.Name.Equals(DynamoProperties.Resources.GroupStyleDefaultReview)); + GroupStyleItem styleItem = null; + //This will try to find the GroupStyle review + styleItem = annotationViewModel.GroupStyleList.OfType().FirstOrDefault(x => x.Name.Equals(DynamoProperties.Resources.GroupStyleDefaultReview)); + if(styleItem == null) + { + //If no GroupStyle is found matching the specific criteria we will use the first one + styleItem = annotationViewModel.GroupStyleList.OfType().First(); + } var groupStyleItem = new GroupStyleItem {Name = styleItem.Name, HexColorString = styleItem.HexColorString}; annotationViewModel.UpdateGroupStyle(groupStyleItem);