From: Aaron Kennedy Date: Tue, 12 Jul 2011 05:09:18 +0000 (+1000) Subject: Don't assert on incorrect file url X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=d9368b7bab1a44c78a035081e4f2ee0eb1df7c33;p=konrad%2Fqtdeclarative.git Don't assert on incorrect file url Exceptions thrown from within a QObject method have the same special origin "string" that we use to identify QObject function objects as QObject function objects. Until we can modify this, or switch to function objects in a later V8, we can't get correct source information for these exceptions. Task-number: QTBUG-20344 Change-Id: I02aa2d81ac78c2951d7ea714f33612160ded2476 Reviewed-on: http://codereview.qt.nokia.com/1475 Reviewed-by: Aaron Kennedy --- diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp index 93f1b3b..ebbfb8c 100644 --- a/src/declarative/qml/qdeclarativeexpression.cpp +++ b/src/declarative/qml/qdeclarativeexpression.cpp @@ -407,10 +407,8 @@ void QDeclarativeExpressionPrivate::exceptionToError(v8::Handle mes v8::Handle description = message->Get(); int lineNumber = message->GetLineNumber(); - Q_ASSERT(name->IsString()); - - v8::Local file = name->ToString(); - if (file->Length() == 0) + v8::Local file = name->IsString()?name->ToString():v8::Local(); + if (file.IsEmpty() || file->Length() == 0) error.setUrl(QUrl(QLatin1String(""))); else error.setUrl(QUrl(QV8Engine::toStringStatic(file)));