patch 8.2.3695: confusing error for missing key
Problem: Confusing error for missing key.
Solution: Use the actualy key for the error. (closes #9241)
diff --git a/src/eval.c b/src/eval.c
index 0e8b6a6..bebe2f0 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -4287,12 +4287,18 @@
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);