patch 8.2.1106: crash when trying to use s: variable in typed command
Problem: Crash when trying to use s: variable in typed command.
Solution: Don't use the script index when not set. (Ken Takata,
closes #6366)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index d37c5c9..fdb422b 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2339,6 +2339,9 @@
scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid);
int idx;
+ if (current_sctx.sc_sid <= 0)
+ return NULL;
+ si = SCRIPT_ITEM(current_sctx.sc_sid);
if (cctx != NULL)
for (idx = 0; idx < cctx->ctx_imports.ga_len; ++idx)
{