diff --git a/src/minify.cpp b/src/minify.cpp index 4a97000..e28ae7d 100644 --- a/src/minify.cpp +++ b/src/minify.cpp @@ -455,7 +455,7 @@ block* do_one_minify_single_block(block* in) ret = l->cls[0]->pls[0]->cmds[0]; // if is a subshell and has some env set: don't remove it - if(in->type == _obj::block_subshell && has_env_set(in)) + if(in->type == _obj::block_subshell && has_env_set(ret)) return nullptr; return ret; @@ -485,6 +485,9 @@ bool r_minify_single_block(_obj* in) // replace value delete t->cmds[i]; t->cmds[i] = ret; + + recurse(r_minify_single_block, in); + return false; } } }; break; diff --git a/src/struc_helper.cpp b/src/struc_helper.cpp index 1f44bff..2c26ee2 100644 --- a/src/struc_helper.cpp +++ b/src/struc_helper.cpp @@ -140,7 +140,7 @@ bool possibly_expands(arglist* in) bool cmd::has_var_assign() { - if(this->args->size() == 0) + if(this->args == nullptr || this->args->size() == 0) { return this->var_assigns.size()>0; }