Skip to content

Commit

Permalink
TailTipWidgets throws IndexOutOfBoundsException when descriptionSize=0,
Browse files Browse the repository at this point in the history
fixes #645
  • Loading branch information
mattirn committed Jan 26, 2021
1 parent 31da519 commit c232acd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion console/src/main/java/org/jline/widget/TailTipWidgets.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2020, the original author or authors.
* Copyright (c) 2002-2021, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand Down Expand Up @@ -498,6 +498,9 @@ private List<AttributedString> compileMainDescription(CmdDesc cmdDesc, int descr
}

private List<AttributedString> compileMainDescription(CmdDesc cmdDesc, int descriptionSize, String lastArg) {
if (descriptionSize == 0 || !descriptionEnabled) {
return new ArrayList<>();
}
List<AttributedString> out = new ArrayList<>();
List<AttributedString> mainDesc = cmdDesc.getMainDesc();
if (mainDesc == null) {
Expand Down Expand Up @@ -549,6 +552,9 @@ private List<AttributedString> compileMainDescription(CmdDesc cmdDesc, int descr
}

private List<AttributedString> compileOptionDescription(CmdDesc cmdDesc, String opt, int descriptionSize) {
if (descriptionSize == 0 || !descriptionEnabled) {
return new ArrayList<>();
}
List<AttributedString> out = new ArrayList<>();
Map<String, List<AttributedString>> optsDesc = cmdDesc.getOptsDesc();
StyleResolver resolver = HelpException.defaultStyle();
Expand Down

0 comments on commit c232acd

Please sign in to comment.