Skip to content

Commit 9ecf880

Browse files
committed
Gracefully fail if the TopicList cannot be resolved
Previously, if the `TopicListAttribute`'s `RelativeTopicBase` or `RootTopic` could not be resolved, then an error would end up getting thrown by `GetTopics()`. This adds in an escape condition so that an empty `List<QueryResultTopicViewmodel>` is returned if no `topic` is resolved.
1 parent 339fa6d commit 9ecf880

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

OnTopic.Editor.AspNetCore/Components/TopicListViewComponent.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ public static List<QueryResultTopicViewModel> GetTopics(
158158
string allowedKeys = ""
159159
) {
160160

161+
/*------------------------------------------------------------------------------------------------------------------------
162+
| Swallow missing topic
163+
\-----------------------------------------------------------------------------------------------------------------------*/
164+
if (topic == null) {
165+
return new List<QueryResultTopicViewModel>();
166+
}
167+
161168
/*------------------------------------------------------------------------------------------------------------------------
162169
| Establish query options
163170
\-----------------------------------------------------------------------------------------------------------------------*/

0 commit comments

Comments
 (0)