From 283b74a599bf89a165cbb4576ead01ea1106539f Mon Sep 17 00:00:00 2001 From: Almas Abdrazak Date: Sun, 25 Jun 2023 01:37:34 -0700 Subject: [PATCH] Fixes #9947 - check that each selector inside of _selectors isn't null before calculating #totalKeys (#9962) Check that selector isn't null before calculating totalKeys. --- .../src/main/java/org/eclipse/jetty/io/SelectorManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java b/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java index ad35aa2f388..fab73091622 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java @@ -148,14 +148,14 @@ public abstract class SelectorManager extends ContainerLifeCycle implements Dump public int getTotalKeys() { int keys = 0; - for (final ManagedSelector selector : _selectors) + for (ManagedSelector selector : _selectors) { - keys += selector.getTotalKeys(); + if (selector != null) + keys += selector.getTotalKeys(); } return keys; } - /** * @return the number of selectors in use */