diff src/vim9compile.c @ 29769:e0259a817d82 v9.0.0224

patch 9.0.0224: Using NULL pointer when skipping compiled code Commit: https://github.com/vim/vim/commit/4875d6ab068f09df88d24d81de40dcd8d56e243d Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 17 15:55:51 2022 +0100 patch 9.0.0224: Using NULL pointer when skipping compiled code Problem: Using NULL pointer when skipping compiled code. Solution: Check for skipping.
author Bram Moolenaar <Bram@vim.org>
date Wed, 17 Aug 2022 17:00:05 +0200
parents c0debb5290b5
children 6b7020f3d856
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1165,11 +1165,14 @@ generate_loadvar(
 	    generate_LOADV(cctx, name + 2);
 	    break;
 	case dest_local:
-	    if (lvar->lv_from_outer > 0)
-		generate_LOADOUTER(cctx, lvar->lv_idx, lvar->lv_from_outer,
+	    if (cctx->ctx_skip != SKIP_YES)
+	    {
+		if (lvar->lv_from_outer > 0)
+		    generate_LOADOUTER(cctx, lvar->lv_idx, lvar->lv_from_outer,
 									 type);
-	    else
-		generate_LOAD(cctx, ISN_LOAD, lvar->lv_idx, NULL, type);
+		else
+		    generate_LOAD(cctx, ISN_LOAD, lvar->lv_idx, NULL, type);
+	    }
 	    break;
 	case dest_expr:
 	    // list or dict value should already be on the stack.
@@ -1952,6 +1955,9 @@ compile_assign_unlet(
 	}
     }
 
+    if (cctx->ctx_skip == SKIP_YES)
+	return OK;
+
     // Load the dict or list.  On the stack we then have:
     // - value (for assignment, not for :unlet)
     // - index