Fixed bug: avoid infinite loop when stringifying an array with holes (index is missing). Put null for missing indexes.

git-svn-id: http://yate.null.ro/svn/yate/trunk@6308 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2018-04-11 12:00:37 +00:00
parent 086a25e1f6
commit fd04da7b91
1 changed files with 5 additions and 4 deletions

View File

@ -3997,11 +3997,12 @@ void JsJSON::stringify(const NamedString* ns, String& buf, int spaces, int inden
String ci(' ',indent + spaces);
buf << "[" << nl;
for (int32_t i = 0; ; ) {
const NamedString* p = jsa->params().getParam(String(i));
if (!p)
continue;
buf << ci;
stringify(p,buf,spaces,indent + spaces);
const NamedString* p = jsa->params().getParam(String(i));
if (p)
stringify(p,buf,spaces,indent + spaces);
else
buf << "null";
if (++i < jsa->length())
buf << "," << nl;
else {