Skip to content

Commit 17432fe

Browse files
committed
iter
1 parent d6e23da commit 17432fe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server/src/main/java/org/elasticsearch/index/mapper/IpFieldMapper.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ protected String contentType() {
568568
protected void parseCreateField(DocumentParserContext context) throws IOException {
569569
InetAddress address;
570570
String value = context.parser().textOrNull();
571+
boolean isNotNull = value != null || nullValue != null;
571572
try {
572573
address = value == null ? nullValue : InetAddresses.forString(value);
573574
} catch (IllegalArgumentException e) {
@@ -582,11 +583,11 @@ protected void parseCreateField(DocumentParserContext context) throws IOExceptio
582583
throw e;
583584
}
584585
}
585-
if (address != null) {
586+
if (isNotNull) {
586587
indexValue(context, address);
587588
}
588589
if (offsetsFieldName != null && context.isImmediateParentAnArray() && context.canAddIgnoredField()) {
589-
if (address != null) {
590+
if (isNotNull) {
590591
BytesRef sortableValue = new BytesRef(InetAddressPoint.encode(address));
591592
context.getOffSetContext().recordOffset(offsetsFieldName, sortableValue);
592593
} else {

0 commit comments

Comments
 (0)