aboutsummaryrefslogtreecommitdiff
path: root/src/wordsplit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wordsplit.c')
-rw-r--r--src/wordsplit.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/wordsplit.c b/src/wordsplit.c
index 4884a22..5cd8daa 100644
--- a/src/wordsplit.c
+++ b/src/wordsplit.c
@@ -1034,9 +1034,14 @@ expvar (struct wordsplit *wsp, const char *str, size_t len,
rc = wordsplit_find_env (wsp, str, i, &vptr);
if (rc == WRDSE_OK)
{
- value = strdup (vptr);
- if (!value)
- rc = WRDSE_NOSPACE;
+ if (vptr)
+ {
+ value = strdup (vptr);
+ if (!value)
+ rc = WRDSE_NOSPACE;
+ }
+ else
+ rc = WRDSE_UNDEF;
}
else if (wsp->ws_flags & WRDSF_GETVAR)
rc = wsp->ws_getvar (&value, str, i, wsp->ws_closure);

Return to:

Send suggestions and report system problems to the System administrator.