summaryrefslogtreecommitdiffstats
path: root/tools/xmlpatterns
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-07-20 09:29:00 (GMT)
committerFrans Englich <frans.englich@nokia.com>2009-07-20 09:53:58 (GMT)
commit0f494029a61a2f9f31917be6e6e954b6bb606085 (patch)
tree964ca90d64c9b68624aa72dbfe36a66bc638e624 /tools/xmlpatterns
parent2d6caf67f8e2a49c5c5516e6837ed6b2862130c2 (diff)
downloadQt-0f494029a61a2f9f31917be6e6e954b6bb606085.zip
Qt-0f494029a61a2f9f31917be6e6e954b6bb606085.tar.gz
Qt-0f494029a61a2f9f31917be6e6e954b6bb606085.tar.bz2
Fix assert in message handling.
Trivial fix. Reported by Michael Brasser. Task-number: 258337 Reviewed-By: Peter Hartmann
Diffstat (limited to 'tools/xmlpatterns')
-rw-r--r--tools/xmlpatterns/qcoloringmessagehandler.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/xmlpatterns/qcoloringmessagehandler.cpp b/tools/xmlpatterns/qcoloringmessagehandler.cpp
index 9616097..0ddb246 100644
--- a/tools/xmlpatterns/qcoloringmessagehandler.cpp
+++ b/tools/xmlpatterns/qcoloringmessagehandler.cpp
@@ -100,12 +100,18 @@ void ColoringMessageHandler::handleMessage(QtMsgType type,
}
case QtFatalMsg:
{
- Q_ASSERT(!sourceLocation.isNull());
const QString errorCode(identifier.fragment());
Q_ASSERT(!errorCode.isEmpty());
QUrl uri(identifier);
uri.setFragment(QString());
+ QString location;
+
+ if(sourceLocation.isNull())
+ location = QXmlPatternistCLI::tr("Unknown location");
+ else
+ location = QString::fromLatin1(sourceLocation.uri().toEncoded());
+
QString errorId;
/* If it's a standard error code, we don't want to output the
* whole URI. */
@@ -117,7 +123,7 @@ void ColoringMessageHandler::handleMessage(QtMsgType type,
if(hasLine)
{
writeUncolored(QXmlPatternistCLI::tr("Error %1 in %2, at line %3, column %4: %5").arg(colorify(errorId, ErrorCode),
- colorify(QString::fromLatin1(sourceLocation.uri().toEncoded()), Location),
+ colorify(location, Location),
colorify(QString::number(sourceLocation.line()), Location),
colorify(QString::number(sourceLocation.column()), Location),
colorifyDescription(description)));
@@ -125,7 +131,7 @@ void ColoringMessageHandler::handleMessage(QtMsgType type,
else
{
writeUncolored(QXmlPatternistCLI::tr("Error %1 in %2: %3").arg(colorify(errorId, ErrorCode),
- colorify(QString::fromLatin1(sourceLocation.uri().toEncoded()), Location),
+ colorify(location, Location),
colorifyDescription(description)));
}
break;