Mercurial > vim
diff src/popupwin.c @ 17421:73e81cd9e6cb v8.1.1709
patch 8.1.1709: Coverity warns for possibly using a NULL pointer
commit https://github.com/vim/vim/commit/403d090e39abdc741c1b2ec0a05361cffd348289
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 17 21:37:32 2019 +0200
patch 8.1.1709: Coverity warns for possibly using a NULL pointer
Problem: Coverity warns for possibly using a NULL pointer.
Solution: Make sure no NULL pointer is used.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 17 Jul 2019 21:45:05 +0200 |
parents | aa4532c1d001 |
children | 6e756ad5ef1a |
line wrap: on
line diff
--- a/src/popupwin.c +++ b/src/popupwin.c @@ -516,7 +516,7 @@ apply_general_options(win_T *wp, dict_T di = dict_find(dict, (char_u *)"borderhighlight", -1); if (di != NULL) { - if (di->di_tv.v_type != VAR_LIST) + if (di->di_tv.v_type != VAR_LIST || di->di_tv.vval.v_list == NULL) emsg(_(e_listreq)); else { @@ -524,17 +524,16 @@ apply_general_options(win_T *wp, dict_T listitem_T *li; int i; - if (list != NULL) - for (i = 0, li = list->lv_first; i < 4 && i < list->lv_len; - ++i, li = li->li_next) - { - str = tv_get_string(&li->li_tv); - if (*str != NUL) - wp->w_border_highlight[i] = vim_strsave(str); - } + for (i = 0, li = list->lv_first; i < 4 && i < list->lv_len; + ++i, li = li->li_next) + { + str = tv_get_string(&li->li_tv); + if (*str != NUL) + wp->w_border_highlight[i] = vim_strsave(str); + } if (list->lv_len == 1 && wp->w_border_highlight[0] != NULL) for (i = 1; i < 4; ++i) - wp->w_border_highlight[i] = + wp->w_border_highlight[i] = vim_strsave(wp->w_border_highlight[0]); } }