ash: consider "local -" case while iterating over local variables in mklocal.

fixes segfault introduced in 0a0acb55db with functions using "local -".
test-case: f() { local -; local x; }; f

note: with this change applied multiple 'local -'s still cause multiple entries to be added to the localvars list.
this problem will be addressed in a separate commit.

Signed-off-by: Eugene Rudoy <gene.devel@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Eugene Rudoy 2015-04-26 23:32:00 +02:00 committed by Denys Vlasenko
parent a818777d42
commit 1285aa62f9

View File

@ -8979,7 +8979,7 @@ mklocal(char *name)
*/
lvp = localvars;
while (lvp) {
if (varcmp(lvp->vp->var_text, name) == 0) {
if (lvp->vp && varcmp(lvp->vp->var_text, name) == 0) {
if (eq)
setvareq(name, 0);
/* else: