aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4arraydata_p.h
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/qv4arraydata_p.h
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/qv4arraydata_p.h')
-rw-r--r--src/qml/jsruntime/qv4arraydata_p.h8
1 files changed, 0 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4arraydata_p.h b/src/qml/jsruntime/qv4arraydata_p.h
index 70c581d75d..c2deb3e385 100644
--- a/src/qml/jsruntime/qv4arraydata_p.h
+++ b/src/qml/jsruntime/qv4arraydata_p.h
@@ -116,8 +116,6 @@ struct Q_QML_EXPORT ArrayData : public Managed
bool isSparse() const { return this && type() == Sparse; }
uint length() const {
- if (!this)
- return 0;
return vtable()->length(this);
}
@@ -130,14 +128,10 @@ struct Q_QML_EXPORT ArrayData : public Managed
}
bool isEmpty(uint i) const {
- if (!this)
- return true;
return (vtable()->get(this, i) == Primitive::emptyValue().asReturnedValue());
}
ReturnedValue get(uint i) const {
- if (!this)
- return Primitive::emptyValue().asReturnedValue();
return vtable()->get(this, i);
}
inline Property *getProperty(uint index);
@@ -242,8 +236,6 @@ struct Q_QML_EXPORT SparseArrayData : public ArrayData
inline Property *ArrayData::getProperty(uint index)
{
- if (!this)
- return 0;
if (type() != Sparse) {
SimpleArrayData *that = static_cast<SimpleArrayData *>(this);
return that->getProperty(index);