diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/PluralFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/PluralFormat.java index 3e34ed8f7c9..3b26452bc70 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/PluralFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/PluralFormat.java @@ -727,7 +727,7 @@ public class PluralFormat extends UFormat { int matchedIndex = -1; // Iterate over (ARG_SELECTOR ARG_START message ARG_LIMIT) tuples // until the end of the plural-only pattern. - do { + while (partIndex < count) { MessagePattern.Part partSelector=msgPattern.getPart(partIndex++); if (partSelector.getType() != MessagePattern.Part.Type.ARG_SELECTOR) { // Bad format @@ -760,7 +760,7 @@ public class PluralFormat extends UFormat { matchedWord = currArg; keyword = pattern.substring(partStart.getLimit(), partLimit.getIndex()); } - } while(partIndex