From 6ccd5425b18e1f46a3ed64e92b4390ffddd7d7d4 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Mon, 13 Dec 2010 21:56:50 +0100 Subject: Make sure math operators don't run on empty/unset variable --- libui.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libui.sh b/libui.sh index 7c93e67..ba96037 100644 --- a/libui.sh +++ b/libui.sh @@ -389,10 +389,10 @@ _dia_ask_number () then show_warning 'Invalid number input' "$ANSWER_NUMBER is not a number! try again." else - if [ -n "$3" -a $3 != '0' -a $ANSWER_NUMBER -gt $3 ] + if [ -n "$3" ] && [ $3 != '0' -a $ANSWER_NUMBER -gt $3 ] then show_warning 'Invalid number input' "$ANSWER_NUMBER is bigger then the maximum,$3! try again." - elif [ -n "$2" -a $ANSWER_NUMBER -lt $2 ] + elif [ -n "$2" ] && [ $ANSWER_NUMBER -lt $2 ] then show_warning 'Invalid number input' "$ANSWER_NUMBER is smaller then the minimum,$2! try again." else @@ -592,10 +592,10 @@ _cli_ask_number () then show_warning 'Invalid number input' "$ANSWER_NUMBER is not a number! try again." else - if [ -n "$3" -a $3 != '0' -a $ANSWER_NUMBER -gt $3 ] + if [ -n "$3" ] && [ $3 != '0' -a $ANSWER_NUMBER -gt $3 ] then show_warning 'Invalid number input' "$ANSWER_NUMBER is bigger then the maximum,$3! try again." - elif [ -n "$2" -a $ANSWER_NUMBER -lt $2 ] + elif [ -n "$2" ] && [ $ANSWER_NUMBER -lt $2 ] then show_warning 'Invalid number input' "$ANSWER_NUMBER is smaller then the minimum,$2! try again." else -- cgit v1.2.2