summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-07-17 21:37:32 +0200
committerBram Moolenaar <Bram@vim.org>2019-07-17 21:37:32 +0200
commit403d090e39abdc741c1b2ec0a05361cffd348289 (patch)
tree079522a7da6fab4b67a69832ebff8b52859cf8be
parent3fb4f4762b49a5b5a54c17e0296e49ec815aee6c (diff)
patch 8.1.1709: Coverity warns for possibly using a NULL pointerv8.1.1709
Problem: Coverity warns for possibly using a NULL pointer. Solution: Make sure no NULL pointer is used.
-rw-r--r--src/popupwin.c19
-rw-r--r--src/testdir/test_popupwin.vim2
-rw-r--r--src/version.c2
3 files changed, 13 insertions, 10 deletions
diff --git a/src/popupwin.c b/src/popupwin.c
index 322537bf87..f977517262 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -516,7 +516,7 @@ apply_general_options(win_T *wp, dict_T *dict)
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 *dict)
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]);
}
}
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 26d1c94ae1..740ac61396 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -634,6 +634,8 @@ func Test_popup_invalid_arguments()
call popup_clear()
call assert_fails('call popup_create("text", #{borderhighlight: "none"})', 'E714:')
call popup_clear()
+ call assert_fails('call popup_create("text", #{borderhighlight: test_null_list()})', 'E714:')
+ call popup_clear()
call assert_fails('call popup_create("text", #{borderchars: "none"})', 'E714:')
call popup_clear()
diff --git a/src/version.c b/src/version.c
index d1f5eba6b2..0ac981ed7a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -778,6 +778,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1709,
+/**/
1708,
/**/
1707,