Commit 1b98bebf authored by rswindell's avatar rswindell
Browse files

JS_GetClass() can return NULL. Don't dereference the return value without

checking for non-NULL value.
parent 78bb0597
......@@ -2310,7 +2310,7 @@ js_get_msg_body(JSContext *cx, uintN argc, jsval *arglist)
break;
} else if(JSVAL_IS_OBJECT(argv[n])) { /* Use existing header */
JSClass *oc=JS_GetClass(cx, JSVAL_TO_OBJECT(argv[n]));
if(strcmp(oc->name, js_msghdr_class.name)==0) {
if(oc != NULL && strcmp(oc->name, js_msghdr_class.name) == 0) {
privatemsg_t *pmsg=JS_GetPrivate(cx,JSVAL_TO_OBJECT(argv[n]));
if(pmsg != NULL) {
......@@ -2424,7 +2424,7 @@ js_get_msg_tail(JSContext *cx, uintN argc, jsval *arglist)
break;
} else if(JSVAL_IS_OBJECT(argv[n])) { /* Use existing header */
JSClass *oc=JS_GetClass(cx, JSVAL_TO_OBJECT(argv[n]));
if(strcmp(oc->name, js_msghdr_class.name)==0) {
if(oc != NULL && strcmp(oc->name, js_msghdr_class.name) == 0) {
privatemsg_t *pmsg=JS_GetPrivate(cx,JSVAL_TO_OBJECT(argv[n]));
if(pmsg != NULL) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment