From 9d96a82c807149c7077baa546e18e9dadb7e7c37 Mon Sep 17 00:00:00 2001 From: Octavian Damiean Date: Sun, 30 Jun 2013 22:04:00 +0200 Subject: [PATCH 1/2] Added null check for count in _lp_temp_sensors() to stop division by zero errors in case count is still zero. --- liquidprompt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/liquidprompt b/liquidprompt index 9cc75a7..6be218d 100755 --- a/liquidprompt +++ b/liquidprompt @@ -1200,6 +1200,9 @@ _lp_temp_sensors() { temperature=$(($temperature+$i)) count=$(($count+1)) done + if test $count -eq 0; then + exit + fi echo -ne "$(($temperature/$count))" } From 0a161a6d3f9768c50124ab378c71e8b6b7d40ec5 Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 7 Jul 2013 15:22:19 +0200 Subject: [PATCH 2/2] Use the same convention for test as elsewhere in the code --- liquidprompt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/liquidprompt b/liquidprompt index 6be218d..7ebd03b 100755 --- a/liquidprompt +++ b/liquidprompt @@ -1200,10 +1200,11 @@ _lp_temp_sensors() { temperature=$(($temperature+$i)) count=$(($count+1)) done - if test $count -eq 0; then + if [[ $count -ne 0 ]] ; then + echo -ne "$(($temperature/$count))" + else exit fi - echo -ne "$(($temperature/$count))" } # Will set _lp_temp_function so the temperature monitoring feature use an