Skip to content

Commit 7663dfd

Browse files
committed
[grid] Adding a NPE check
[skip ci]
1 parent 8851340 commit 7663dfd

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

java/src/org/openqa/selenium/grid/node/local/LocalNode.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,16 @@ private LocalNode(
157157
.expireAfterAccess(sessionTimeout)
158158
.ticker(ticker)
159159
.removalListener((RemovalListener<SessionId, SessionSlot>) notification -> {
160-
// Attempt to stop the session
161-
LOG.log(Debug.getDebugLogLevel(), "Stopping session {0}", notification.getKey().toString());
162-
SessionSlot slot = notification.getValue();
163-
if (!slot.isAvailable()) {
164-
slot.stop();
160+
if (notification.getKey() != null && notification.getValue() != null) {
161+
// Attempt to stop the session
162+
LOG.log(Debug.getDebugLogLevel(), "Stopping session {0}",
163+
notification.getKey().toString());
164+
SessionSlot slot = notification.getValue();
165+
if (!slot.isAvailable()) {
166+
slot.stop();
167+
}
168+
} else {
169+
LOG.log(Debug.getDebugLogLevel(), "Received stop session notification with null values");
165170
}
166171
})
167172
.build();

0 commit comments

Comments
 (0)