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,10 +736,14 @@ public final class SortingCodecReader extends FilterCodecReader {
|
||||||
if (timesCached > 1) {
|
if (timesCached > 1) {
|
||||||
assert norms == false : "[" + field + "] norms must not be cached twice";
|
assert norms == false : "[" + field + "] norms must not be cached twice";
|
||||||
boolean isSortField = false;
|
boolean isSortField = false;
|
||||||
for (SortField sf : metaData.getSort().getSort()) {
|
// For things that aren't sort fields, it's possible for sort to be null here
|
||||||
if (field.equals(sf.getField())) {
|
// In the event that we accidentally cache twice, its better not to throw an NPE
|
||||||
isSortField = true;
|
if (metaData.getSort() != null) {
|
||||||
break;
|
for (SortField sf : metaData.getSort().getSort()) {
|
||||||
|
if (field.equals(sf.getField())) {
|
||||||
|
isSortField = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert timesCached == 2
|
assert timesCached == 2
|
||||||
|
|
Loading…
Reference in New Issue