Skip to content

Commit 80e9751

Browse files
committed
Account for potentially null result
Resolves `CS8602`. In the `ReverseTopicMappingService`, the `MapAsync()` method could, potentially, return a `null` object. In this case, it shouldn't be added to the `targetList`. This is an unexpected situation, but an easy condition to check for, while also satisfying code analysis.
1 parent fd4d361 commit 80e9751

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

OnTopic/Mapping/Reverse/ReverseTopicMappingService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ TopicCollection targetList
608608
var topicTask = await Task.WhenAny(taskQueue).ConfigureAwait(false);
609609
taskQueue.Remove(topicTask);
610610
var topic = await topicTask.ConfigureAwait(false);
611-
if (!targetList.Contains(topic.Key)) {
611+
if (topic != null && !targetList.Contains(topic.Key)) {
612612
targetList.Add(topic);
613613
}
614614
}

0 commit comments

Comments
 (0)