# HG changeset patch # User Bram Moolenaar # Date 1563391804 -7200 # Node ID aa4532c1d00126aaecc4b517f1e44caa856a6839 # Parent 2a82ba1d2dd9f05336deb543c7b6dca4b6efd276 patch 8.1.1707: Coverity warns for possibly using a NULL pointer commit https://github.com/vim/vim/commit/cfdbc5adde49cbab939e8164555ed0b8d9ce000b Author: Bram Moolenaar Date: Wed Jul 17 21:27:52 2019 +0200 patch 8.1.1707: Coverity warns for possibly using a NULL pointer Problem: Coverity warns for possibly using a NULL pointer. Solution: Change the logic to make sure no NULL pointer is used. diff --git a/src/popupwin.c b/src/popupwin.c --- a/src/popupwin.c +++ b/src/popupwin.c @@ -587,14 +587,13 @@ apply_general_options(win_T *wp, dict_T di = dict_find(dict, (char_u *)"mask", -1); if (di != NULL) { - int ok = TRUE; + int ok = FALSE; - if (di->di_tv.v_type != VAR_LIST) - ok = FALSE; - else if (di->di_tv.vval.v_list != NULL) + if (di->di_tv.v_type == VAR_LIST && di->di_tv.vval.v_list != NULL) { listitem_T *li; + ok = TRUE; for (li = di->di_tv.vval.v_list->lv_first; li != NULL; li = li->li_next) { diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim --- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -643,6 +643,10 @@ func Test_popup_invalid_arguments() call popup_clear() call assert_fails('call popup_create([#{text: "text", props: ["none"]}], {})', 'E715:') call popup_clear() + call assert_fails('call popup_create("text", #{mask: ["asdf"]})', 'E475:') + call popup_clear() + call assert_fails('call popup_create("text", #{mask: test_null_list()})', 'E475:') + call popup_clear() endfunc func Test_win_execute_closing_curwin() diff --git a/src/version.c b/src/version.c --- 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 */ /**/ + 1707, +/**/ 1706, /**/ 1705,