diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-05-03 22:40:58 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-05-04 10:50:36 +0200 |
commit | 793888888b381abb1e360e1144f5fc5d7a37cc72 (patch) | |
tree | 3261efde8c73380d949d351ab1379e22d9325fa2 /src/qml/qml/v8/qjsvalue.cpp | |
parent | 4838545a1873324509c6ba84449e17bb0f93ac58 (diff) |
UINT_MAX is not a valid array index
Make sure indexed getter and setter in QJSValue do the right
thing for UINT_MAX
Change-Id: I57bc24016d85050b30422efc18479d17ec95ba56
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/v8/qjsvalue.cpp')
-rw-r--r-- | src/qml/qml/v8/qjsvalue.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/qml/qml/v8/qjsvalue.cpp b/src/qml/qml/v8/qjsvalue.cpp index b0202fa0d3..839bdab197 100644 --- a/src/qml/qml/v8/qjsvalue.cpp +++ b/src/qml/qml/v8/qjsvalue.cpp @@ -767,7 +767,7 @@ QJSValue QJSValue::property(quint32 arrayIndex) const QV4::ExecutionContext *ctx = d->engine->current; try { - QV4::Value v = o->getIndexed(ctx, arrayIndex); + QV4::Value v = arrayIndex == UINT_MAX ? o->get(ctx, ctx->engine->id_uintMax) : o->getIndexed(ctx, arrayIndex); return new QJSValuePrivate(d->engine, v); } catch (QV4::Exception &e) { e.accept(ctx); @@ -828,7 +828,10 @@ void QJSValue::setProperty(quint32 arrayIndex, const QJSValue& value) QV4::ExecutionContext *ctx = d->engine->current; try { - o->putIndexed(ctx, arrayIndex, value.d->value); + if (arrayIndex != UINT_MAX) + o->putIndexed(ctx, arrayIndex, value.d->value); + else + o->put(ctx, ctx->engine->id_uintMax, value.d->value); } catch (QV4::Exception &e) { e.accept(ctx); } |