Skip to content

Commit 3ba11e9

Browse files
committed
Avoid possible NPE, fixes #214
1 parent 5ff7555 commit 3ba11e9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/org/fusesource/jansi/AnsiPrintStream.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ public void install() throws IOException {
7676
}
7777

7878
public void uninstall() throws IOException {
79-
getOut().uninstall();
79+
// If the system output stream has been closed, out should be null, so avoid a NPE
80+
AnsiOutputStream out = getOut();
81+
if (out != null) {
82+
out.uninstall();
83+
}
8084
}
8185

8286
@Override

0 commit comments

Comments
 (0)