From b2d094e56d00774dd883f434624d571316a7e5c0 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 12 Dec 2012 21:39:26 +0100 Subject: [PATCH] Fix StringCtr::call Check for the number of arguments, not whether the first arg is undefined. Change-Id: I23829404dfd4547f829b1bc7a4407017d79f7162 Reviewed-by: Simon Hausmann --- qv4ecmaobjects.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/qv4ecmaobjects.cpp b/qv4ecmaobjects.cpp index e89ceab..bd360ee 100644 --- a/qv4ecmaobjects.cpp +++ b/qv4ecmaobjects.cpp @@ -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) -- 2.7.4