Skip to content

Commit

Permalink
Add null check in AutorouteEntries (#16020)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored May 9, 2024
1 parent 23ee4f1 commit c20c63e
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public AutorouteEntries(IVolatileDocumentManager<AutorouteStateDocument> autorou

public async Task<(bool, AutorouteEntry)> TryGetEntryByPathAsync(string path)
{
ArgumentException.ThrowIfNullOrEmpty(path);

await EnsureInitializedAsync();

if (_contentItemIds.TryGetValue(path.TrimEnd('/'), out var entry))
Expand All @@ -46,6 +48,8 @@ public AutorouteEntries(IVolatileDocumentManager<AutorouteStateDocument> autorou

public async Task<(bool, AutorouteEntry)> TryGetEntryByContentItemIdAsync(string contentItemId)
{
ArgumentException.ThrowIfNullOrEmpty(contentItemId);

await EnsureInitializedAsync();

if (_paths.TryGetValue(contentItemId, out var entry))
Expand Down

0 comments on commit c20c63e

Please sign in to comment.