diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-10-27 08:54:26 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-10-27 15:19:12 +0100 |
commit | 57e5407178ce05f577bd032a7bab2508434a4b02 (patch) | |
tree | fed4c0d9e82d619c572bd6d86ea1cc9a92436e58 /src/qml/jsruntime/qv4argumentsobject.cpp | |
parent | 8539aa87345fc9a972d9b400fa42fd742b01d4ed (diff) |
Don't check the this pointer for 0 in member functions
This actually violates the C++ standard that defines that
you aren't allowed to call member functions on an invalid
object.
Instead insert the 0 pointer checks on the caller side where
required.
Change-Id: I8be3c3831594bb6482e9ef6de6e590ec437ac0f8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4argumentsobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4argumentsobject.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp index d79521ca2f..4af8927a2e 100644 --- a/src/qml/jsruntime/qv4argumentsobject.cpp +++ b/src/qml/jsruntime/qv4argumentsobject.cpp @@ -97,7 +97,7 @@ bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const fullyCreate(); Scope scope(ctx); - Property *pd = arrayData()->getProperty(index); + Property *pd = arrayData() ? arrayData()->getProperty(index) : 0; Property map; PropertyAttributes mapAttrs; bool isMapped = false; @@ -106,6 +106,7 @@ bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const isMapped = arrayData()->attributes(index).isAccessor() && pd->getter() == context()->d()->engine->argumentsAccessors[index].getter(); if (isMapped) { + Q_ASSERT(arrayData()); mapAttrs = arrayData()->attributes(index); map.copy(*pd, mapAttrs); setArrayAttributes(index, Attr_Data); @@ -119,6 +120,7 @@ bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const ctx->d()->strictMode = strict; if (isMapped && attrs.isData()) { + Q_ASSERT(arrayData()); ScopedCallData callData(scope, 1); callData->thisObject = this->asReturnedValue(); callData->args[0] = desc.value; |