Skip to content

Commit

Permalink
UsersToMap can be null (#2545)
Browse files Browse the repository at this point in the history
🐛 (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
  • Loading branch information
MrHinsh authored Dec 3, 2024
2 parents 38ff5aa + 2a52f70 commit 0af6562
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private void ValidateAllUsersExistOrAreMapped(List<WorkItemData> 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 "
Expand Down

0 comments on commit 0af6562

Please sign in to comment.