Skip to content

Apache Lucene open-source search software

LUCENE-6039: add another null check

Michael McCandlessf7e6d2f177c7
diff --git a/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java b/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java
index 4e5f652025d..7355f9f4f1c 100644
--- a/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java
+++ b/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java
@@ -140,6 +140,9 @@ public final class FieldInfo {
}
void setDocValuesType(DocValuesType type) {
+ if (type == null) {
+ throw new NullPointerException("DocValuesType cannot be null (field: \"" + name + "\")");
+ }
if (docValuesType != DocValuesType.NONE && type != DocValuesType.NONE && docValuesType != type) {
throw new IllegalArgumentException("cannot change DocValues type from " + docValuesType + " to " + type + " for field \"" + name + "\"");
}