Skip to content

Commit 64afeb9

Browse files
committed
Handled potential passing of null reference to Load()
Better to check if `attribute.RootTopic` is `null` upfront.
1 parent c2873fd commit 64afeb9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

OnTopic.Editor.AspNetCore.Attributes/TopicListAttribute/TopicListViewComponent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ public IViewComponentResult Invoke(
9595
_ => baseTopic
9696
};
9797
}
98-
else {
99-
rootTopic = _topicRepository.Load(attribute.RootTopic?.UniqueKey);
98+
else if (attribute.RootTopic is not null) {
99+
rootTopic = _topicRepository.Load(attribute.RootTopic.UniqueKey);
100100
}
101101

102102
if (rootTopic is not null && !String.IsNullOrEmpty(attribute.RelativeTopicPath)) {

0 commit comments

Comments
 (0)