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

Add missing NULL pointer check to js_iniReadAll()

iniReadFile() can return NULL upon file read error or malloc error. Let's not
crash if that happens.
parent cd049a4e
No related branches found
No related tags found
No related merge requests found
......@@ -1670,7 +1670,7 @@ js_iniReadAll(JSContext *cx, uintN argc, jsval *arglist)
rc=JS_SUSPENDREQUEST(cx);
str_list_t list = iniReadFile(p->fp);
JS_RESUMEREQUEST(cx, rc);
for(size_t i = 0; list[i] != NULL; i++) {
for(size_t i = 0; list != NULL && list[i] != NULL; i++) {
JSString* js_str;
if((js_str = JS_NewStringCopyZ(cx, list[i])) == NULL)
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment