Skip to content

Commit 1f1ebb4

Browse files
tvernums1monw
authored andcommitted
Add additional null check in _cat/shards
The target of the func lambda may be null (e.g. in a mixed cluster where older nodes lack some of the values) Relates: #33858 / 331caba Closes #33877
1 parent ff934e3 commit 1f1ebb4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ protected Table getTableWithHeader(final RestRequest request) {
194194
private static <S, T> Object getOrNull(S stats, Function<S, T> accessor, Function<T, Object> func) {
195195
if(stats != null) {
196196
T t = accessor.apply(stats);
197-
return func.apply(t);
197+
if (t != null) {
198+
return func.apply(t);
199+
}
198200
}
199201
return null;
200202
}

0 commit comments

Comments
 (0)