Fix ObjectCtor::call
authorLars Knoll <lars.knoll@digia.com>
Wed, 12 Dec 2012 21:10:50 +0000 (22:10 +0100)
committerSimon Hausmann <simon.hausmann@digia.com>
Wed, 12 Dec 2012 23:09:22 +0000 (00:09 +0100)
Change-Id: Ifa74ba46ed5213661d009fcd748d66f2b5670814
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
qv4ecmaobjects.cpp

index fc428e6..1a95c14 100644 (file)
@@ -537,7 +537,9 @@ Value ObjectCtor::construct(ExecutionContext *ctx)
 
 Value ObjectCtor::call(ExecutionContext *ctx)
 {
-    return Value::fromObject(ctx->engine->newObject());
+    if (!ctx->argumentCount || ctx->argument(0).isUndefined() || ctx->argument(0).isNull())
+        return Value::fromObject(ctx->engine->newObject());
+    return __qmljs_to_object(ctx->argument(0), ctx);
 }
 
 Value ObjectCtor::__get__(ExecutionContext *ctx, String *name)