common: Allow undefined $gsu_errors.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 3 Mar 2015 17:28:19 +0000 (18:28 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 3 Mar 2015 17:28:19 +0000 (18:28 +0100)
If this variable is undefined, and the nounset option is turned on
(set -u), gsu aborts early when setting up the gsu_error_txt array.

Fix this by using ${gsu_errors:-} instead of plain $gsu_errors to
allow for scripts without error codes.

Reported by Congmao Wang.

common

diff --git a/common b/common
index e3268907a385cb5417ac60796f2f0a50fcbeed2f..d41809585ab22e282fdc57ed757ea9e716b66aae 100644 (file)
--- a/common
+++ b/common
@@ -19,7 +19,7 @@ E_GSU_GETOPTS                 getopts error
 E_GSU_DIALOG                   dialog error
 E_GSU_MKTEMP                   mktemp error
 E_GSU_MENU_TREE                        invalid menu tree
-$gsu_errors
+${gsu_errors:-}
 "
        local a b i=0
        while read a b; do