Skip to content

Commit 32f9322

Browse files
committed
Added null conditional operator to sourceTopic
Added check for cases where `sourceTopic` may be null (e.g., for legacy pages not associated with a Topic).
1 parent 7cd6dc9 commit 32f9322

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Ignia.Topics.Web.Mvc/Controllers/LayoutControllerBase{T}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ protected Topic GetNavigationRoot(Topic currentTopic, int fromRoot = 2, string d
178178
/// <param name="sourceTopic">The <see cref="Topic"/> to pull the values from.</param>
179179
private static int DistanceFromRoot(Topic sourceTopic) {
180180
var distance = 1;
181-
while (sourceTopic.Parent != null) {
181+
while (sourceTopic?.Parent != null) {
182182
sourceTopic = sourceTopic.Parent;
183183
distance++;
184184
}

0 commit comments

Comments
 (0)