]> granicus.if.org Git - vim/commitdiff
patch 8.2.3596: crash when using :pedit in Vim9 script v8.2.3596
authorYegappan Lakshmanan <yegappan@yahoo.com>
Mon, 15 Nov 2021 11:22:09 +0000 (11:22 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 15 Nov 2021 11:22:09 +0000 (11:22 +0000)
Problem:    Crash when using :pedit in Vim9 script.
Solution:   Move check for arguments to after checking there are arguments.
            (Yegappan Lakshmanan, closes #9134, closes #9135)

src/popupwin.c
src/testdir/test_vim9_cmd.vim
src/version.c

index d86c6c0ef114d28b44e90e003d86206f17d1c6d5..59bdf86b8247c3c2aeaa06bb5b625a0d358e88aa 100644 (file)
@@ -1851,13 +1851,13 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type)
     int                nr;
     int                i;
 
-    if (in_vim9script()
-           && (check_for_string_or_number_or_list_arg(argvars, 0) == FAIL
-               || check_for_dict_arg(argvars, 1) == FAIL))
-       return NULL;
-
     if (argvars != NULL)
     {
+       if (in_vim9script()
+               && (check_for_string_or_number_or_list_arg(argvars, 0) == FAIL
+                   || check_for_dict_arg(argvars, 1) == FAIL))
+           return NULL;
+
        // Check that arguments look OK.
        if (argvars[0].v_type == VAR_NUMBER)
        {
index 3bc13ade79e54673f59d347aa500e27e46db5eba..9f1cdf12a3a41076276ab3cb109df5b2b28a269b 100644 (file)
@@ -1570,5 +1570,16 @@ def Test_no_space_after_command()
   CheckDefExecAndScriptFailure(lines, 'E486:', 1)
 enddef
 
+" Test for the 'popuppreview' option
+def Test_popuppreview()
+  set previewpopup=height:10,width:60
+  pedit Xfile
+  var id = popup_findpreview()
+  assert_notequal(id, 0)
+  assert_match('Xfile', popup_getoptions(id).title)
+  popup_clear()
+  set previewpopup&
+enddef
+
 
 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
index 19014e67aef94d824d1bc7628a67aa519f98fd19..39a61c915091fbcad4da18e097ccf5a34ff085b2 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3596,
 /**/
     3595,
 /**/