From: Kevin Lamonte Date: Sat, 7 Apr 2018 17:49:32 +0000 (-0400) Subject: #29 avoid potential NPE X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=0525b2ed026e0d510fdf23f6d8f4cb4562a17e0b;p=fanfix-jexer.git #29 avoid potential NPE --- diff --git a/src/jexer/backend/ECMA48Terminal.java b/src/jexer/backend/ECMA48Terminal.java index 7edb64b..84f6528 100644 --- a/src/jexer/backend/ECMA48Terminal.java +++ b/src/jexer/backend/ECMA48Terminal.java @@ -507,9 +507,12 @@ public class ECMA48Terminal extends LogicalScreen e.printStackTrace(); } - // Disable mouse reporting and show cursor - output.printf("%s%s%s", mouse(false), cursor(true), normal()); - output.flush(); + // Disable mouse reporting and show cursor. Defensive null check + // here in case closeTerminal() is called twice. + if (output != null) { + output.printf("%s%s%s", mouse(false), cursor(true), normal()); + output.flush(); + } if (setRawMode) { sttyCooked();