summaryrefslogtreecommitdiff
path: root/examples/xmlpatterns/filetree
diff options
context:
space:
mode:
authorTopi Reiniƶ <topi.reinio@nokia.com>2012-07-04 13:38:58 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-11 23:40:13 +0200
commitb2b97badcf0f4082c03b64873871e885daeb4f5c (patch)
treef8be2c077e08ce66ac283e838865faeec51ad0f8 /examples/xmlpatterns/filetree
parent0c1be7119f169d0a147cecc2d251ba172832dc77 (diff)
downloadqtxmlpatterns-b2b97badcf0f4082c03b64873871e885daeb4f5c.tar.gz
Qt XML Patterns File System Example: Do not bind to a null node index
Adds a check for validity of the file node index before running an XQuery. In evaluateResult(), QXmlQuery binds to a QXmlNodeModelIndex variable without checking if it's valid. This causes an assert to trigger if the default directory that the example tries to open does not exist. In this case, m_fileNode has the default (null) value when evaluateResult() is invoked on QComboBox::currentIndexChanged() signal. Task-number: QTBUG-26081 Change-Id: I03c39939b57fcf658527ce3110fdc30d204de520 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'examples/xmlpatterns/filetree')
-rw-r--r--examples/xmlpatterns/filetree/mainwindow.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/xmlpatterns/filetree/mainwindow.cpp b/examples/xmlpatterns/filetree/mainwindow.cpp
index 83c3ebf..3116305 100644
--- a/examples/xmlpatterns/filetree/mainwindow.cpp
+++ b/examples/xmlpatterns/filetree/mainwindow.cpp
@@ -94,7 +94,7 @@ void MainWindow::on_queryBox_currentIndexChanged()
//! [3]
void MainWindow::evaluateResult()
{
- if (queryBox->currentText().isEmpty())
+ if (queryBox->currentText().isEmpty() || m_fileNode.isNull())
return;
QXmlQuery query(m_namePool);