aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4objectproto.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-10-27 08:54:26 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-10-27 15:19:12 +0100
commit57e5407178ce05f577bd032a7bab2508434a4b02 (patch)
treefed4c0d9e82d619c572bd6d86ea1cc9a92436e58 /src/qml/jsruntime/qv4objectproto.cpp
parent8539aa87345fc9a972d9b400fa42fd742b01d4ed (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/qv4objectproto.cpp')
-rw-r--r--src/qml/jsruntime/qv4objectproto.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp
index a1c61307d1..9cbf4b204e 100644
--- a/src/qml/jsruntime/qv4objectproto.cpp
+++ b/src/qml/jsruntime/qv4objectproto.cpp
@@ -329,11 +329,11 @@ ReturnedValue ObjectPrototype::method_isSealed(CallContext *ctx)
if (!o->arrayData() || !o->arrayData()->length())
return Encode(true);
- if (o->arrayData()->length() && !o->arrayData()->attrs())
+ Q_ASSERT(o->arrayData() && o->arrayData()->length());
+ if (!o->arrayData()->attrs())
return Encode(false);
for (uint i = 0; i < o->arrayData()->alloc(); ++i) {
- // ### Fix for sparse arrays
if (!o->arrayData()->isEmpty(i))
if (o->arrayData()->attributes(i).isConfigurable())
return Encode(false);
@@ -355,14 +355,14 @@ ReturnedValue ObjectPrototype::method_isFrozen(CallContext *ctx)
if (o->internalClass() != o->internalClass()->frozen())
return Encode(false);
- if (!o->arrayData()->length())
+ if (!o->arrayData() || !o->arrayData()->length())
return Encode(true);
- if (o->arrayData()->length() && !o->arrayData()->attrs())
+ Q_ASSERT(o->arrayData() && o->arrayData()->length());
+ if (!o->arrayData()->attrs())
return Encode(false);
for (uint i = 0; i < o->arrayData()->alloc(); ++i) {
- // ### Fix for sparse arrays
if (!o->arrayData()->isEmpty(i))
if (o->arrayData()->attributes(i).isConfigurable() || o->arrayData()->attributes(i).isWritable())
return Encode(false);