From b1308a37eaa3bc2e3e28642881220040f9f3eae2 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 5 Feb 2013 22:14:03 +0100 Subject: [PATCH] Don't insert undefined elements into the sparse array When converting to a sparse array, skip the missing elements. Change-Id: Ic5ae7973c200d530ad4f89aa23b46a2581198b5a Reviewed-by: Erik Verbruggen --- src/v4/qv4object.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/v4/qv4object.cpp b/src/v4/qv4object.cpp index d8231b5..5e57c89 100644 --- a/src/v4/qv4object.cpp +++ b/src/v4/qv4object.cpp @@ -851,8 +851,10 @@ void Object::initSparse() if (!sparseArray) { sparseArray = new SparseArray; for (int i = 0; i < arrayDataLen; ++i) { - SparseArrayNode *n = sparseArray->insert(i); - n->value = i + arrayOffset; + if (arrayData[i].type != PropertyDescriptor::Generic) { + SparseArrayNode *n = sparseArray->insert(i); + n->value = i + arrayOffset; + } } uint off = arrayOffset; -- 2.7.4