Skip to content

Commit

Permalink
Issue jetty#9947 check if selecto isn't null before calculating #tota…
Browse files Browse the repository at this point in the history
…lKeys
  • Loading branch information
strogiyotec committed Jun 24, 2023
1 parent 7661a24 commit ca5a76f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,13 @@ protected void execute(Runnable task)
@ManagedAttribute(value = "Total number of keys in all selectors", readonly = true)
public int getTotalKeys()
{
if (_selectors == null || _selectors.length == 0)
{
return 0;
}
int keys = 0;
for (final ManagedSelector selector : _selectors)
for (ManagedSelector selector : _selectors)
{
keys += selector.getTotalKeys();
if (selector != null)
{
keys += selector.getTotalKeys();
}
}
return keys;
}
Expand Down

0 comments on commit ca5a76f

Please sign in to comment.