diff options
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/eval.c b/src/eval.c index 69f3af8cee..5d4c720b09 100644 --- a/src/eval.c +++ b/src/eval.c @@ -6746,20 +6746,24 @@ get_dict_tv(arg, rettv, evaluate) clear_tv(&tvkey); goto failret; } - key = get_tv_string_buf_chk(&tvkey, buf); - if (key == NULL || *key == NUL) + if (evaluate) { - /* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */ - if (key != NULL) - EMSG(_(e_emptykey)); - clear_tv(&tvkey); - goto failret; + key = get_tv_string_buf_chk(&tvkey, buf); + if (key == NULL || *key == NUL) + { + /* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */ + if (key != NULL) + EMSG(_(e_emptykey)); + clear_tv(&tvkey); + goto failret; + } } *arg = skipwhite(*arg + 1); if (eval1(arg, &tv, evaluate) == FAIL) /* recursive! */ { - clear_tv(&tvkey); + if (evaluate) + clear_tv(&tvkey); goto failret; } if (evaluate) |