summaryrefslogtreecommitdiffstats
path: root/document/src/main
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-09-17 13:36:13 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2018-09-17 13:37:05 +0200
commit8815babcd93c17d9b904568f9cd0434d659a2840 (patch)
treea55d35ead790a2d9f27dcaca32dd2c80365db42f /document/src/main
parenta940b388669b3ad3cc364c6f6ce638919ee76676 (diff)
Avoid NPE on non-exiting field
Diffstat (limited to 'document/src/main')
-rw-r--r--document/src/main/java/com/yahoo/document/DocumentUpdate.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/document/src/main/java/com/yahoo/document/DocumentUpdate.java b/document/src/main/java/com/yahoo/document/DocumentUpdate.java
index 301d6af0f54..028215c0d6c 100644
--- a/document/src/main/java/com/yahoo/document/DocumentUpdate.java
+++ b/document/src/main/java/com/yahoo/document/DocumentUpdate.java
@@ -278,7 +278,8 @@ public class DocumentUpdate extends DocumentOperation implements Iterable<FieldP
* @return the update for the field, or null if that field has no update in this
*/
public FieldUpdate getFieldUpdate(String fieldName) {
- return getFieldUpdate(documentType.getField(fieldName));
+ Field field = documentType.getField(fieldName);
+ return field != null ? getFieldUpdate(field) : null;
}
private FieldUpdate getFieldUpdateById(Integer fieldId) {
return id2FieldUpdateMap.get(fieldId);
@@ -396,7 +397,8 @@ public class DocumentUpdate extends DocumentOperation implements Iterable<FieldP
}
public FieldUpdate removeFieldUpdate(String fieldName) {
- return removeFieldUpdate(documentType.getField(fieldName));
+ Field field = documentType.getField(fieldName);
+ return field != null ? removeFieldUpdate(field) : null;
}
/**