From: Lars Knoll Date: Wed, 12 Dec 2012 20:39:26 +0000 (+0100) Subject: Fix StringCtr::call X-Git-Tag: upstream/5.2.1~669^2~659^2~692 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2d094e56d00774dd883f434624d571316a7e5c0;p=platform%2Fupstream%2Fqtdeclarative.git Fix StringCtr::call Check for the number of arguments, not whether the first arg is undefined. Change-Id: I23829404dfd4547f829b1bc7a4407017d79f7162 Reviewed-by: Simon Hausmann --- 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)