Commit 78b1e390 authored by rswindell's avatar rswindell
Browse files

Check return value of JS_SetElement (and return failure if false).

parent e79de03e
......@@ -325,7 +325,8 @@ js_readall(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
js_readln(cx, obj, 0, NULL, &line);
if(line==JSVAL_NULL)
break;
JS_SetElement(cx, array, len++, &line);
if(!JS_SetElement(cx, array, len++, &line))
break;
}
*rval = OBJECT_TO_JSVAL(array);
......
......@@ -150,14 +150,16 @@ JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_
return(NULL); /* and again on Aug-7-2001 and Oct-21-2001 */
val=OBJECT_TO_JSVAL(dirobj);
JS_SetElement(cx, dir_list, index, &val);
if(!JS_SetElement(cx, dir_list, index, &val))
return(NULL);
}
if(!JS_GetArrayLength(cx, lib_list, &index))
return(NULL);
val=OBJECT_TO_JSVAL(libobj);
JS_SetElement(cx, lib_list, index, &val);
if(!JS_SetElement(cx, lib_list, index, &val))
return(NULL);
}
return(areaobj);
......
......@@ -156,14 +156,16 @@ JSObject* DLLCALL js_CreateMsgAreaObject(JSContext* cx, JSObject* parent, scfg_t
return(NULL);
val=OBJECT_TO_JSVAL(subobj);
JS_SetElement(cx, sub_list, index, &val);
if(!JS_SetElement(cx, sub_list, index, &val))
return(NULL);
}
if(!JS_GetArrayLength(cx, grp_list, &index))
return(NULL);
val=OBJECT_TO_JSVAL(grpobj);
JS_SetElement(cx, grp_list, index, &val);
if(!JS_SetElement(cx, grp_list, index, &val))
return(NULL);
}
return(areaobj);
......
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