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>
//! [3]
void MainWindow::evaluateResult()
{
- if (queryBox->currentText().isEmpty())
+ if (queryBox->currentText().isEmpty() || m_fileNode.isNull())
return;
QXmlQuery query(m_namePool);