aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/jsruntime/qv4numberobject.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp
index 09644c161d..255d0212c1 100644
--- a/src/qml/jsruntime/qv4numberobject.cpp
+++ b/src/qml/jsruntime/qv4numberobject.cpp
@@ -163,7 +163,9 @@ void NumberPrototype::method_isNaN(const BuiltinFunction *, Scope &scope, CallDa
}
double v = callData->args[0].toNumber();
- scope.result = Encode(std::isnan(v));
+ // cast to bool explicitly as std::isnan() may give us ::isnan(), which
+ // sometimes returns an int and we don't want the Encode(int) overload.
+ scope.result = Encode(bool(std::isnan(v)));
}
void NumberPrototype::method_toString(const BuiltinFunction *, Scope &scope, CallData *callData)