Skip to content

Commit 4fe651c

Browse files
committed
Correcly handle nulls during path traversal
If we run into a null, just treat that the same as any other missing field -- so if ignoreMissing is true, then we should not throw an exception.
1 parent 242dbe6 commit 4fe651c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/src/main/java/org/elasticsearch/ingest/IngestDocument.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ public void removeField(String path, boolean ignoreMissing) {
345345
}
346346

347347
String leafKey = fieldPath.pathElements[fieldPath.pathElements.length - 1];
348-
if (context == null) {
348+
if (context == null && ignoreMissing == false) {
349349
throw new IllegalArgumentException(Errors.cannotRemove(path, leafKey, null));
350350
} else if (context instanceof IngestCtxMap map) { // optimization: handle IngestCtxMap separately from Map
351351
if (map.containsKey(leafKey)) {

0 commit comments

Comments
 (0)