Skip to content

Commit

Permalink
Add array length check
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-strecker-sonarsource committed May 15, 2024
1 parent 3e7cb9a commit b269fb7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ private void RegisterCodeBlockActions(SonarCodeBlockStartAnalysisContext<SyntaxK
}
codeBlockStart.RegisterCodeBlockEndAction(codeBlockEnd =>
{
if (allConstantAccesses)
if (allConstantAccesses
&& codeBlockCandidates.Any()) // Net core 2.2: PushRange throws for empty arrays https://stackoverflow.com/questions/7487097/strange-exception-when-using-concurrentstack-in-c-sharp
{
controllerCandidates.PushRange([.. codeBlockCandidates]);
}
Expand Down

0 comments on commit b269fb7

Please sign in to comment.