Skip to content

Commit

Permalink
Fix StackOverflowError in detached Docker container
Browse files Browse the repository at this point in the history
When running inside a detached Docker container, calling LineReaderImpl.redisplay
resulted in a StackOverflowError. The reason for this is that redisplay eventually
calls doList, which again calls redisplay because the size.getRows() is 0.
  • Loading branch information
Kay Werndli committed Feb 28, 2024
1 parent 19c031c commit 9d83ab2
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5006,7 +5006,10 @@ protected boolean doList(
PostResult postResult = computePost(possible, null, null, completed);
int lines = postResult.lines;
int listMax = getInt(LIST_MAX, DEFAULT_LIST_MAX);
if (listMax > 0 && possible.size() >= listMax || lines >= size.getRows() - promptLines) {
int rows = size.getRows();
int possibleSize = possible.size();
if (possibleSize == 0 || rows == 0) return false;
if (listMax > 0 && possibleSize >= listMax || lines >= rows - promptLines) {
if (!forSuggestion) {
// prompt
post = () -> new AttributedString(getAppName() + ": do you wish to see all " + possible.size()
Expand Down

0 comments on commit 9d83ab2

Please sign in to comment.