diff --git a/lucene/src/java/org/apache/lucene/util/automaton/State.java b/lucene/src/java/org/apache/lucene/util/automaton/State.java index 52bed7192e0..88f318d9189 100644 --- a/lucene/src/java/org/apache/lucene/util/automaton/State.java +++ b/lucene/src/java/org/apache/lucene/util/automaton/State.java @@ -232,7 +232,8 @@ public class State implements Serializable, Comparable { /** Sorts transitions array in-place. */ public void sortTransitions(Comparator comparator) { - Arrays.sort(transitionsArray, 0, numTransitions, comparator); + if (numTransitions > 1) + Arrays.sort(transitionsArray, 0, numTransitions, comparator); } /**