#29 avoid potential NPE
authorKevin Lamonte <kevin.lamonte@gmail.com>
Sat, 7 Apr 2018 17:49:32 +0000 (13:49 -0400)
committerKevin Lamonte <kevin.lamonte@gmail.com>
Sat, 7 Apr 2018 17:49:32 +0000 (13:49 -0400)
src/jexer/backend/ECMA48Terminal.java

index 7edb64b20e87b519fa939ababfc781a7c6cb54e2..84f6528c5a348832642bc21315dea8b1ddbb5bbc 100644 (file)
@@ -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();