Skip to content

Commit cd55c59

Browse files
authored
Fixed visibleParToAllParIndex parameter check (#1022)
1 parent 15965d1 commit cd55c59

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ public final int visibleParToAllParIndex(int visibleParIndex) {
978978
if (visibleParIndex < 0) {
979979
throw new IllegalArgumentException("Visible paragraph index cannot be negative but was " + visibleParIndex);
980980
}
981-
if (visibleParIndex >= getVisibleParagraphs().size()) {
981+
if (visibleParIndex > 0 && visibleParIndex >= getVisibleParagraphs().size()) {
982982
throw new IllegalArgumentException(String.format(
983983
"Visible paragraphs' last index is [%s] but visibleParIndex was [%s]",
984984
getVisibleParagraphs().size() - 1, visibleParIndex)

0 commit comments

Comments
 (0)