Skip to content

Commit 1c0aa97

Browse files
committed
patch 8.2.2148: Vim9: crash when user command doesn't match
Problem: Vim9: crash when user command doesn't match. Solution: Adjust command index. (closes #7479)
1 parent 530bed9 commit 1c0aa97

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/ex_docmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3520,7 +3520,7 @@ find_ex_command(
35203520
++p;
35213521
p = find_ucmd(eap, p, full, NULL, NULL);
35223522
}
3523-
if (p == eap->cmd)
3523+
if (p == NULL || p == eap->cmd)
35243524
eap->cmdidx = CMD_SIZE;
35253525
}
35263526

src/testdir/test_vim9_cmd.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,5 +701,14 @@ def Test_cmd_argument_without_colon()
701701
delete('Xfile')
702702
enddef
703703

704+
def Test_ambiguous_user_cmd()
705+
var lines =<< trim END
706+
com Cmd1 eval 0
707+
com Cmd2 eval 0
708+
Cmd
709+
END
710+
CheckScriptFailure(lines, 'E464:')
711+
enddef
712+
704713

705714
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2148,
753755
/**/
754756
2147,
755757
/**/

0 commit comments

Comments
 (0)