Fix: Cannot invoke method startsWith() on null object.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 22 Feb 2017 16:09:02 +0200
changeset 838 98cdbead06be
parent 837 4ba0fe28be27
child 839 e22ea617339d
Fix: Cannot invoke method startsWith() on null object.
.gradle/init.d/springColorLogging.gradle
--- a/.gradle/init.d/springColorLogging.gradle	Wed Feb 22 10:23:40 2017 +0200
+++ b/.gradle/init.d/springColorLogging.gradle	Wed Feb 22 16:09:02 2017 +0200
@@ -1,7 +1,8 @@
 gradle.taskGraph.whenReady { graph ->
     // graph.getAllTasks().findAll().each { println it }
     def console = System.console() != null
-    if (! console) { console = System.getenv()["TERM"].startsWith("xterm") }
+    def term = System.getenv()["TERM"];
+    if (! console && term != null) { console = term.startsWith("xterm") }
     if (! console) return
     graph.getAllTasks().findAll({it.name.equals("bootRun")}).each {
         it.systemProperties 'spring.output.ansi.enabled': 'always'