diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/IndexFollowingIT.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/IndexFollowingIT.java index 39975d5c291..84062962e37 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/IndexFollowingIT.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/IndexFollowingIT.java @@ -807,7 +807,7 @@ public class IndexFollowingIT extends CcrIntegTestCase { AtomicBoolean closed = new AtomicBoolean(false); clusterService.addListener(event -> { IndexMetaData indexMetaData = event.state().metaData().index(indexName); - if (indexMetaData.getState() == IndexMetaData.State.CLOSE) { + if (indexMetaData != null && indexMetaData.getState() == IndexMetaData.State.CLOSE) { closed.set(true); } });