patch 9.0.1370: crash when using a NULL object
Problem: Crash when using a NULL object. (Ernie Rael)
Solution: Check for NULL and give an error message. (closes #12083)
diff --git a/src/vim9execute.c b/src/vim9execute.c
index bc4a1fc..f8ce101 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -5321,6 +5321,13 @@
}
object_T *obj = tv->vval.v_object;
+ if (obj == NULL)
+ {
+ SOURCING_LNUM = iptr->isn_lnum;
+ emsg(_(e_using_null_object));
+ goto on_error;
+ }
+
int idx;
if (iptr->isn_type == ISN_GET_OBJ_MEMBER)
idx = iptr->isn_arg.number;