Skip to content
Snippets Groups Projects
Commit ba6fcfab authored by rswindell's avatar rswindell
Browse files

At MCMLXXIX's request, change File.iniGetObject() to return null/undefined

if the specified section doesn't exist (or contains no keys/values).
parent da4cdb42
No related branches found
No related tags found
No related merge requests found
......@@ -951,11 +951,16 @@ js_iniGetObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rv
if(argv[0]!=JSVAL_VOID && argv[0]!=JSVAL_NULL)
section=JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
object = JS_NewObject(cx, NULL, NULL, obj);
rc=JS_SUSPENDREQUEST(cx);
list = iniReadNamedStringList(p->fp,section);
JS_RESUMEREQUEST(cx, rc);
if(list==NULL) /* New behavior at request of MCMLXXIX: return NULL/undefined if specified section doesn't exist */
return JSVAL_NULL;
object = JS_NewObject(cx, NULL, NULL, obj);
for(i=0;list && list[i];i++) {
JS_DefineProperty(cx, object, list[i]->name
,get_value(cx,list[i]->value)
......
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