Skip to content

Commit 9a3b003

Browse files
authored
fix NPE in TransportGetDeploymentStatsAction (elastic#131678)
* fix NPE in TransportGetDeploymentStatsAction * better fix
1 parent c483c67 commit 9a3b003

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportGetDeploymentStatsAction.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,15 @@ static GetDeploymentStatsAction.Response addFailedRoutes(
261261
List<AssignmentStats.NodeStats> nodeStats = new ArrayList<>();
262262

263263
for (var routingEntry : nonStartedEntries.getValue().entrySet()) {
264-
nodeStats.add(
265-
AssignmentStats.NodeStats.forNotStartedState(
266-
nodes.get(routingEntry.getKey()),
267-
routingEntry.getValue().getState(),
268-
routingEntry.getValue().getReason()
269-
)
270-
);
264+
if (nodes.nodeExists(routingEntry.getKey())) {
265+
nodeStats.add(
266+
AssignmentStats.NodeStats.forNotStartedState(
267+
nodes.get(routingEntry.getKey()),
268+
routingEntry.getValue().getState(),
269+
routingEntry.getValue().getReason()
270+
)
271+
);
272+
}
271273
}
272274

273275
nodeStats.sort(Comparator.comparing(n -> n.getNode().getId()));

0 commit comments

Comments
 (0)