Problem: Vim9: crash when using line continuation inside :def.
Solution: Check for no more lines available.
res = [1, 2, 3]->sort()
enddef
+def Line_continuation_in_def(dir: string = ''): string
+ let path: string = empty(dir)
+ \ ? 'empty'
+ \ : 'full'
+ return path
+enddef
+
+def Test_line_continuation_in_def()
+ assert_equal('full', Line_continuation_in_def('.'))
+enddef
+
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1037,
/**/
1036,
/**/
while (++lnum < cctx->ctx_ufunc->uf_lines.ga_len)
{
char_u *line = ((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)[lnum];
- char_u *p = skipwhite(line);
+ char_u *p;
+ if (line == NULL)
+ break;
+ p = skipwhite(line);
if (*p != NUL && !comment_start(p))
return p;
}