diff src/vim9execute.c @ 25159:b2a6a71a11e8 v8.2.3116

patch 8.2.3116: Vim9: crash when debugging a function with line continuation Commit: https://github.com/vim/vim/commit/303215d60cece0462f040035502b5bc95373bd6e Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 7 20:10:43 2021 +0200 patch 8.2.3116: Vim9: crash when debugging a function with line continuation Problem: Vim9: crash when debugging a function with line continuation. Solution: Check for a NULL pointer. (closes https://github.com/vim/vim/issues/8521)
author Bram Moolenaar <Bram@vim.org>
date Wed, 07 Jul 2021 20:15:03 +0200
parents 5c7a09cf97a1
children fbb530e081ca
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1497,9 +1497,11 @@ handle_debug(isn_T *iptr, ectx_T *ectx)
 	ga_init2(&ga, sizeof(char_u *), 10);
 	for (lnum = iptr->isn_lnum; lnum < end_lnum; ++lnum)
 	{
-	    char_u *p = skipwhite(
-			       ((char_u **)ufunc->uf_lines.ga_data)[lnum - 1]);
-
+	    char_u *p = ((char_u **)ufunc->uf_lines.ga_data)[lnum - 1];
+
+	    if (p == NULL)
+		continue;  // left over from continuation line
+	    p = skipwhite(p);
 	    if (*p == '#')
 		break;
 	    if (ga_grow(&ga, 1) == OK)