Fix StringCtr::call
authorLars Knoll <lars.knoll@digia.com>
Wed, 12 Dec 2012 20:39:26 +0000 (21:39 +0100)
committerSimon Hausmann <simon.hausmann@digia.com>
Wed, 12 Dec 2012 23:08:10 +0000 (00:08 +0100)
Check for the number of arguments, not whether the first arg
is undefined.

Change-Id: I23829404dfd4547f829b1bc7a4407017d79f7162
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
qv4ecmaobjects.cpp

index e89ceab..bd360ee 100644 (file)
@@ -1002,11 +1002,12 @@ Value StringCtor::construct(ExecutionContext *ctx)
 
 Value StringCtor::call(ExecutionContext *ctx)
 {
-    const Value arg = ctx->argument(0);
-    if (arg.isUndefined())
-        return Value::fromString(ctx->engine->newString(QString()));
+    Value value;
+    if (ctx->argumentCount)
+        value = Value::fromString(ctx->argument(0).toString(ctx));
     else
-        return __qmljs_to_string(arg, ctx);
+        value = Value::fromString(ctx, QString());
+    return value;
 }
 
 void StringPrototype::init(ExecutionContext *ctx, const Value &ctor)