mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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)
This commit is contained in:
@@ -235,6 +235,24 @@ def Test_object_not_set()
|
|||||||
END
|
END
|
||||||
v9.CheckScriptFailure(lines, 'E1360:')
|
v9.CheckScriptFailure(lines, 'E1360:')
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
|
||||||
|
class Class
|
||||||
|
this.id: string
|
||||||
|
def Method1()
|
||||||
|
echo 'Method1' .. this.id
|
||||||
|
enddef
|
||||||
|
endclass
|
||||||
|
|
||||||
|
var obj: Class
|
||||||
|
def Func()
|
||||||
|
obj.Method1()
|
||||||
|
enddef
|
||||||
|
Func()
|
||||||
|
END
|
||||||
|
v9.CheckScriptFailure(lines, 'E1360:')
|
||||||
|
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
|
|
||||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1370,
|
||||||
/**/
|
/**/
|
||||||
1369,
|
1369,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -5321,6 +5321,13 @@ exec_instructions(ectx_T *ectx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
object_T *obj = tv->vval.v_object;
|
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;
|
int idx;
|
||||||
if (iptr->isn_type == ISN_GET_OBJ_MEMBER)
|
if (iptr->isn_type == ISN_GET_OBJ_MEMBER)
|
||||||
idx = iptr->isn_arg.number;
|
idx = iptr->isn_arg.number;
|
||||||
|
Reference in New Issue
Block a user