From 79ebcc31c5ab55d8cbfe135d4ee77cd68dd0940e Mon Sep 17 00:00:00 2001 From: kimchy Date: Tue, 19 Apr 2011 16:10:51 +0300 Subject: [PATCH] double check that there are mappings before trying to call the post process method --- .../index/mapper/xcontent/XContentDocumentMapper.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapper.java index 9a3ce9d79d1..d07d515b391 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/xcontent/XContentDocumentMapper.java @@ -521,9 +521,11 @@ public class XContentDocumentMapper implements DocumentMapper, ToXContent { @Override public void processDocumentAfterIndex(Document doc) { for (Fieldable field : doc.getFields()) { FieldMappers fieldMappers = mappers().indexName(field.name()); - FieldMapper mapper = fieldMappers.mapper(); - if (mapper != null) { - mapper.processFieldAfterIndex(field); + if (fieldMappers != null) { + FieldMapper mapper = fieldMappers.mapper(); + if (mapper != null) { + mapper.processFieldAfterIndex(field); + } } } }