Commit 913560eb authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

util.printd: Don't crash if we get an unexpected oDate argument

BUGS: 443255
parent 4304bcc3
Pipeline #85657 passed with stage
in 27 minutes and 59 seconds
......@@ -91,6 +91,12 @@ static KJSObject printd(KJSContext *context, void *, const KJSArguments &argumen
QLocale locale(QStringLiteral("en_US"));
const QStringList str = arguments.at(1).toString(context).split(QRegularExpression(QStringLiteral("\\W")));
if (str.count() < 7) {
qWarning() << "Unexpected printd oDate argument" << arguments.at(1).toString(context);
return context->throwException(QStringLiteral("Invalid arguments"));
}
QString myStr = QStringLiteral("%1/%2/%3 %4:%5:%6").arg(str[1], str[2], str[3], str[4], str[5], str[6]);
QDateTime date = locale.toDateTime(myStr, QStringLiteral("MMM/d/yyyy H:m:s"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment