Cat nodes api: prevent NPEs in case there are multiple client nodes

If you connect to a client node and call _cat/nodes, and there is at least another client node in the cluster, the http address cannot be retrieved thus we get an NPE. This commit prevents an NPE from being thrown. This bug was introduced with #16770
This commit is contained in:
javanna 2016-03-01 15:11:07 +01:00 committed by Luca Cavanna
parent 8182a282d4
commit a70be3a10f
1 changed files with 1 additions and 1 deletions

View File

@ -249,7 +249,7 @@ public class RestNodesAction extends AbstractCatAction {
} else {
table.addCell("-");
}
final Map<String, String> serviceAttributes = info.getServiceAttributes();
final Map<String, String> serviceAttributes = info == null ? null : info.getServiceAttributes();
if (serviceAttributes != null) {
table.addCell(serviceAttributes.getOrDefault("http_address", "-"));
} else {