hush: small fix to last commit

die_if_script() indeed dies only in scripts! Must handle the case where it continues.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2017-07-17 16:50:20 +02:00
parent e32b6503e7
commit 0ba80e4fa2

View File

@ -5736,7 +5736,7 @@ static NOINLINE const char *expand_one_var(char **to_be_freed_pp, char *arg, cha
if (len < 0) /* bash compat */
die_if_script("%s: substring expression < 0", var);
}
if (len == 0 || !val || beg >= strlen(val)) {
if (len <= 0 || !val || beg >= strlen(val)) {
arith_err:
val = NULL;
} else {