From 65ec4ea62972e021065d5a5be83b04bb8da2561a Mon Sep 17 00:00:00 2001 From: Paul Rigge Date: Mon, 1 Jan 2018 20:20:57 -0800 Subject: [PATCH] Add assertions for watchers The clang static analyzer convinced itself lp->ll_newkey could be NULL. This adds an assertion that checks this doesn't actually happen, as well as a parallel assertion for di->di_key. --- src/nvim/eval.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/nvim/eval.c b/src/nvim/eval.c index f30840041b..555a0506d9 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -2480,9 +2480,11 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, notify: if (watched) { if (oldtv.v_type == VAR_UNKNOWN) { + assert(lp->ll_newkey != NULL); tv_dict_watcher_notify(dict, (char *)lp->ll_newkey, lp->ll_tv, NULL); } else { dictitem_T *di = lp->ll_di; + assert(di->di_key != NULL); tv_dict_watcher_notify(dict, (char *)di->di_key, lp->ll_tv, &oldtv); tv_clear(&oldtv); }