Skip to content

Commit dc0a128

Browse files
committed
[grid] Fixing possible NPE: the fact that slot.isAvailable() returns false does not imply there is a session, the slot can be reserved but the session is not ready yet.
1 parent 7343b52 commit dc0a128

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

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

+9-7
Original file line numberDiff line numberDiff line change
@@ -470,13 +470,15 @@ public NodeStatus getStatus() {
470470
Optional<Session> session = Optional.empty();
471471
if (!slot.isAvailable()) {
472472
ActiveSession activeSession = slot.getSession();
473-
session = Optional.of(
474-
new Session(
475-
activeSession.getId(),
476-
activeSession.getUri(),
477-
slot.getStereotype(),
478-
activeSession.getCapabilities(),
479-
activeSession.getStartTime()));
473+
if (activeSession != null) {
474+
session = Optional.of(
475+
new Session(
476+
activeSession.getId(),
477+
activeSession.getUri(),
478+
slot.getStereotype(),
479+
activeSession.getCapabilities(),
480+
activeSession.getStartTime()));
481+
}
480482
}
481483

482484
return new Slot(

0 commit comments

Comments
 (0)