From b2c154709b08d30a920d187bab8010ab35bfe375 Mon Sep 17 00:00:00 2001 From: koskila Date: Sat, 26 Oct 2024 22:16:10 +0300 Subject: [PATCH] Fix #1075 Improves handling custom sort order by checking for empty values. Also fixes a typo in a comment :) --- .../Provisioning/ObjectHandlers/ObjectTermGroups.cs | 3 +-- .../Provisioning/Providers/Xml/PnPObjectsMapper.cs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/PnP.Framework/Provisioning/ObjectHandlers/ObjectTermGroups.cs b/src/lib/PnP.Framework/Provisioning/ObjectHandlers/ObjectTermGroups.cs index 07e4e23d5..ce00f8f7b 100644 --- a/src/lib/PnP.Framework/Provisioning/ObjectHandlers/ObjectTermGroups.cs +++ b/src/lib/PnP.Framework/Provisioning/ObjectHandlers/ObjectTermGroups.cs @@ -311,9 +311,8 @@ from m in termGroup.GroupManagerPrincipalNames { var sortOrder = customSortOrder.Split(new[] { ':' }).ToList(); - var currentTermIndex = sortOrder.Where(i => new Guid(i) == term.Id).FirstOrDefault(); + var currentTermIndex = sortOrder.Where(i => !String.IsNullOrEmpty(i) && new Guid(i) == term.Id).FirstOrDefault(); modelTerm.CustomSortOrder = sortOrder.IndexOf(currentTermIndex) + 1; - } } termsToReturn = termsToReturn.OrderBy(t => t.CustomSortOrder).ToList(); diff --git a/src/lib/PnP.Framework/Provisioning/Providers/Xml/PnPObjectsMapper.cs b/src/lib/PnP.Framework/Provisioning/Providers/Xml/PnPObjectsMapper.cs index f4822c3f2..17b60cea1 100644 --- a/src/lib/PnP.Framework/Provisioning/Providers/Xml/PnPObjectsMapper.cs +++ b/src/lib/PnP.Framework/Provisioning/Providers/Xml/PnPObjectsMapper.cs @@ -218,7 +218,7 @@ public static void MapProperties(Object source, Object destination, Dictionary