Skip to content

Commit

Permalink
Prevent ArgumentOutOfRangeException
Browse files Browse the repository at this point in the history
  • Loading branch information
Coding-Enthusiast committed Oct 22, 2023
1 parent 3f42d4d commit d9d4a1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Src/FinderOuter/ViewModels/KnowledgeBaseViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public KnowledgeBaseViewModel()
public KnowledgeBaseViewModel(KB kb) : this()
{
int i = Array.FindIndex(KBList, x => x.Value == kb);
if (i >= 0)
if (i >= 0 && i < KBList.Length)
{
// Note that using FirstOrDefault only sets SelectedKB and doesn't affect ListBox
SelectedKB = KBList.ElementAt(i);
Expand Down

0 comments on commit d9d4a1e

Please sign in to comment.