Skip to content

Commit

Permalink
Avoid possible NPE, fixes #214
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Jul 23, 2021
1 parent 5ff7555 commit 3ba11e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/org/fusesource/jansi/AnsiPrintStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ public void install() throws IOException {
}

public void uninstall() throws IOException {
getOut().uninstall();
// If the system output stream has been closed, out should be null, so avoid a NPE
AnsiOutputStream out = getOut();
if (out != null) {
out.uninstall();
}
}

@Override
Expand Down

0 comments on commit 3ba11e9

Please sign in to comment.