Skip to content

Commit 0af6562

Browse files
authored
UsersToMap can be null (#2545)
🐛 (TfsWorkItemMigrationProcessor.cs): add null check for usersToMap to prevent potential null reference exception 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. FYI @satano Closes: #2544 Discussion: #2540
2 parents 38ff5aa + 2a52f70 commit 0af6562

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ private void ValidateAllUsersExistOrAreMapped(List<WorkItemData> sourceWorkItems
229229
{
230230
contextLog.Information("Validating::Check that all users in the source exist in the target or are mapped!");
231231
IdentityMapResult usersToMap = CommonTools.UserMapping.GetUsersInSourceMappedToTargetForWorkItems(this, sourceWorkItems);
232-
if (usersToMap.IdentityMap != null && usersToMap.IdentityMap.Count > 0)
232+
if (usersToMap != null && usersToMap.IdentityMap != null && usersToMap.IdentityMap.Count > 0)
233233
{
234234
Log.LogWarning("Validating Failed! There are {usersToMap} users that exist in the source that do not exist "
235235
+ "in the target. This will not cause any errors, but may result in disconnected users that could have "

0 commit comments

Comments
 (0)