From fc3a805514842cacc821c64f1c04adf612965a53 Mon Sep 17 00:00:00 2001 From: kimchy Date: Thu, 18 Mar 2010 14:08:45 +0200 Subject: [PATCH] NullPointerexception at org.elasticsearch.action.get.GetResponse.sourceAsString, closes #68 --- .../main/java/org/elasticsearch/action/get/GetResponse.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java index 02c59027e3910..155a8061a73db 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/get/GetResponse.java @@ -107,6 +107,9 @@ public byte[] source() { * The source of the document (as a string). */ public String sourceAsString() { + if (source == null) { + return null; + } return Unicode.fromBytes(source); }