mirror of https://github.com/apache/lucene.git
Adjust assertion check to not throw an NPE (#13479)
This commit is contained in:
parent
51e60f49f8
commit
cfdc747cde
|
@ -736,12 +736,16 @@ public final class SortingCodecReader extends FilterCodecReader {
|
|||
if (timesCached > 1) {
|
||||
assert norms == false : "[" + field + "] norms must not be cached twice";
|
||||
boolean isSortField = false;
|
||||
// For things that aren't sort fields, it's possible for sort to be null here
|
||||
// In the event that we accidentally cache twice, its better not to throw an NPE
|
||||
if (metaData.getSort() != null) {
|
||||
for (SortField sf : metaData.getSort().getSort()) {
|
||||
if (field.equals(sf.getField())) {
|
||||
isSortField = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert timesCached == 2
|
||||
: "["
|
||||
+ field
|
||||
|
|
Loading…
Reference in New Issue