diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-11-08 22:48:17 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-08 22:48:17 -0500 |
commit | 4e6f00dd29332ce549006e8df1b1392ed4209954 (patch) | |
tree | 0c5671c8e96454a752c160f6778a088186c6cb31 /src/nvim/eval/encode.c | |
parent | 94062831b38941a3516bb3bdc8c20486a91fd900 (diff) | |
download | rneovim-4e6f00dd29332ce549006e8df1b1392ed4209954.tar.gz rneovim-4e6f00dd29332ce549006e8df1b1392ed4209954.tar.bz2 rneovim-4e6f00dd29332ce549006e8df1b1392ed4209954.zip |
gcc/analyzer: fix false positives for NULL (#13248)
Close https://github.com/neovim/neovim/issues/13158
Diffstat (limited to 'src/nvim/eval/encode.c')
-rw-r--r-- | src/nvim/eval/encode.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c index 137f099df6..9a9f2e4287 100644 --- a/src/nvim/eval/encode.c +++ b/src/nvim/eval/encode.c @@ -159,8 +159,11 @@ static int conv_error(const char *const msg, const MPConvStack *const mpstack, vim_snprintf((char *)IObuff, IOSIZE, idx_msg, idx); ga_concat(&msg_ga, IObuff); } else { - typval_T key_tv = *TV_LIST_ITEM_TV( - tv_list_first(TV_LIST_ITEM_TV(li)->vval.v_list)); + assert(li != NULL); + listitem_T *const first_item = + tv_list_first(TV_LIST_ITEM_TV(li)->vval.v_list); + assert(first_item != NULL); + typval_T key_tv = *TV_LIST_ITEM_TV(first_item); char *const key = encode_tv2echo(&key_tv, NULL); vim_snprintf((char *) IObuff, IOSIZE, key_pair_msg, key, idx); xfree(key); |