aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/eval.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 96fc79504f..b011ee9d54 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -18104,23 +18104,23 @@ void set_vim_var_list(int idx, list_T *val)
}
/// Set Dictionary v: variable to "val".
-void set_vim_var_dict(int idx, dict_T *val) FUNC_ATTR_NONNULL_ALL
+void set_vim_var_dict(int idx, dict_T *val)
{
dict_unref(vimvars[idx].vv_dict);
+ vimvars[idx].vv_dict = val;
- // Set readonly
- int todo = (int)val->dv_hashtab.ht_used;
- for (hashitem_T *hi = val->dv_hashtab.ht_array; todo > 0 ; ++hi) {
- if (HASHITEM_EMPTY(hi)) {
- continue;
+ if (val != NULL) {
+ ++val->dv_refcount;
+ // Set readonly
+ size_t todo = val->dv_hashtab.ht_used;
+ for (hashitem_T *hi = val->dv_hashtab.ht_array; todo > 0 ; ++hi) {
+ if (HASHITEM_EMPTY(hi)) {
+ continue;
+ }
+ --todo;
+ HI2DI(hi)->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
}
-
- --todo;
- HI2DI(hi)->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
}
-
- vimvars[idx].vv_dict = val;
- ++val->dv_refcount;
}
/*