Skip to content
Snippets Groups Projects
Commit a2d6dc86 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Better invalid argument reporting (null object) from js_gotoxy()

The calling script will still terminate if it does this, but at least the
caller will get a useful JS exception.

Related to fix for issue #769
parent 049c18c4
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
Pipeline #6529 passed
...@@ -1931,8 +1931,10 @@ js_gotoxy(JSContext *cx, uintN argc, jsval *arglist) ...@@ -1931,8 +1931,10 @@ js_gotoxy(JSContext *cx, uintN argc, jsval *arglist)
if(JSVAL_IS_OBJECT(argv[0])) { if(JSVAL_IS_OBJECT(argv[0])) {
JSObject* obj = JSVAL_TO_OBJECT(argv[0]); JSObject* obj = JSVAL_TO_OBJECT(argv[0]);
if(obj == nullptr) if(obj == nullptr) {
JS_ReportError(cx, "invalid object argument in call to %s", __FUNCTION__);
return JS_FALSE; return JS_FALSE;
}
if(!JS_GetProperty(cx, obj, "x", &val) if(!JS_GetProperty(cx, obj, "x", &val)
|| !JS_ValueToInt32(cx,val,&x)) || !JS_ValueToInt32(cx,val,&x))
return JS_FALSE; return JS_FALSE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment