From b3774da97ae4ed77a6776a468e8bed214783a79b Mon Sep 17 00:00:00 2001 From: Anshu Agarwal Date: Wed, 24 Apr 2024 11:37:47 +0530 Subject: [PATCH] fix NPE --- .../main/java/org/opensearch/cluster/routing/ShardRouting.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/opensearch/cluster/routing/ShardRouting.java b/server/src/main/java/org/opensearch/cluster/routing/ShardRouting.java index 7dac72921c67b..8cdca0b465c69 100644 --- a/server/src/main/java/org/opensearch/cluster/routing/ShardRouting.java +++ b/server/src/main/java/org/opensearch/cluster/routing/ShardRouting.java @@ -302,7 +302,8 @@ public ShardIterator shardsIt() { public ShardRouting(ShardId shardId, StreamInput in) throws IOException { this.shardId = shardId; - currentNodeId = in.readOptionalString() != null ? in.readOptionalString().intern() : null; + String currentNodeIdFromStream = in.readOptionalString(); + currentNodeId = currentNodeIdFromStream != null ? currentNodeIdFromStream.intern() : null; relocatingNodeId = in.readOptionalString(); primary = in.readBoolean(); state = ShardRoutingState.fromValue(in.readByte());