diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-11-29 13:44:55 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-11-29 13:44:55 +0000 |
commit | 5c1ec439f0a69e9aa7ece9bbb7d916f48f58be1e (patch) | |
tree | 060671f9ff0ec48a034ca697c6932398ef8fd80a /src/eval.c | |
parent | af377e34b01ba00f9520d2b9de1f911e72db0114 (diff) |
patch 8.2.3695: confusing error for missing keyv8.2.3695
Problem: Confusing error for missing key.
Solution: Use the actualy key for the error. (closes #9241)
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/eval.c b/src/eval.c index 0e8b6a6776..bebe2f0ad5 100644 --- a/src/eval.c +++ b/src/eval.c @@ -4287,12 +4287,18 @@ eval_index_inner( return FAIL; } - item = dict_find(rettv->vval.v_dict, key, (int)keylen); + item = dict_find(rettv->vval.v_dict, key, keylen); - if (item == NULL && verbose) - semsg(_(e_dictkey), key); if (item == NULL) + { + if (verbose) + { + if (keylen > 0) + key[keylen] = NUL; + semsg(_(e_dictkey), key); + } return FAIL; + } copy_tv(&item->di_tv, &tmp); clear_tv(rettv); |