From 2a52f700ff2b46f4d9b14f0d8d8a8803334faa12 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Tue, 3 Dec 2024 15:10:05 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20(TfsWorkItemMigrationProcessor.c?= =?UTF-8?q?s):=20add=20null=20check=20for=20usersToMap=20to=20prevent=20po?= =?UTF-8?q?tential=20null=20reference=20exception?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The change adds a null check for the `usersToMap` object before accessing its `IdentityMap` property. This prevents a potential null reference exception if `usersToMap` is null, ensuring the application handles such cases gracefully and improves overall stability. --- .../Processors/TfsWorkItemMigrationProcessor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessor.cs b/src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessor.cs index 2dd8b86a..1137cf60 100644 --- a/src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessor.cs +++ b/src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessor.cs @@ -229,7 +229,7 @@ private void ValidateAllUsersExistOrAreMapped(List sourceWorkItems { contextLog.Information("Validating::Check that all users in the source exist in the target or are mapped!"); IdentityMapResult usersToMap = CommonTools.UserMapping.GetUsersInSourceMappedToTargetForWorkItems(this, sourceWorkItems); - if (usersToMap.IdentityMap != null && usersToMap.IdentityMap.Count > 0) + if (usersToMap != null && usersToMap.IdentityMap != null && usersToMap.IdentityMap.Count > 0) { Log.LogWarning("Validating Failed! There are {usersToMap} users that exist in the source that do not exist " + "in the target. This will not cause any errors, but may result in disconnected users that could have "