From 57e5407178ce05f577bd032a7bab2508434a4b02 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 27 Oct 2014 08:54:26 +0100 Subject: 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 --- src/qml/jsruntime/qv4arrayobject.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/qml/jsruntime/qv4arrayobject.cpp') diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index eaf474287b..011279ae07 100644 --- a/src/qml/jsruntime/qv4arrayobject.cpp +++ b/src/qml/jsruntime/qv4arrayobject.cpp @@ -268,6 +268,7 @@ ReturnedValue ArrayPrototype::method_push(CallContext *ctx) return Encode::undefined(); instance->arrayCreate(); + Q_ASSERT(instance->arrayData()); uint len = instance->getLength(); @@ -347,6 +348,7 @@ ReturnedValue ArrayPrototype::method_shift(CallContext *ctx) return Encode::undefined(); instance->arrayCreate(); + Q_ASSERT(instance->arrayData()); uint len = instance->getLength(); @@ -534,6 +536,7 @@ ReturnedValue ArrayPrototype::method_unshift(CallContext *ctx) return Encode::undefined(); instance->arrayCreate(); + Q_ASSERT(instance->arrayData()); uint len = instance->getLength(); -- cgit v1.2.3