Skip to content

Commit

Permalink
Fix possible NPE in LineDisciplineTerminal#processInputByte caused by…
Browse files Browse the repository at this point in the history
… non atomic call to EnumMap#getOrDefault, fixes #145
  • Loading branch information
gnodet committed Jul 10, 2017
1 parent 53b2d52 commit ddd7415
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion terminal/src/main/java/org/jline/terminal/Attributes.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ public void setControlChars(EnumMap<ControlChar, Integer> chars) {
}

public int getControlChar(ControlChar c) {
return cchars.getOrDefault(c, -1);
Integer v = cchars.get(c);
return v != null ? v : -1;
}

public void setControlChar(ControlChar c, int value) {
Expand Down

0 comments on commit ddd7415

Please sign in to comment.