summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptvalue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/api/qscriptvalue.cpp')
-rw-r--r--src/script/api/qscriptvalue.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index 7fd1efe..d5aaed7 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -2421,8 +2421,13 @@ QScriptClass *QScriptValue::scriptClass() const
void QScriptValue::setScriptClass(QScriptClass *scriptClass)
{
Q_D(QScriptValue);
- if (!d || !d->isJSC() || !d->jscValue.isObject(&QScriptObject::info))
+ if (!d || !d->isObject())
return;
+ if (!d->jscValue.isObject(&QScriptObject::info)) {
+ qWarning("QScriptValue::setScriptClass() failed: "
+ "cannot change class of non-QScriptObject");
+ return;
+ }
QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue));
QScriptObjectDelegate *delegate = scriptObject->delegate();
if (!delegate || (delegate->type() != QScriptObjectDelegate::ClassObject)) {