Fix crash on FlatModel::added with empty list

Change-Id: I6a5970eb9ccd76e730203c2d95dbd4e4dbb4af8a
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Daniel Teske
2015-03-16 16:14:00 +01:00
parent 2bf6152495
commit b5869e97e9

View File

@@ -617,6 +617,12 @@ void FlatModel::added(FolderNode* parentNode, const QList<Node*> &newNodeList)
qCDebug(logger()) << "FlatModel::added" << parentNode->path() << newNodeList.size() << "nodes"; qCDebug(logger()) << "FlatModel::added" << parentNode->path() << newNodeList.size() << "nodes";
QModelIndex parentIndex = indexForNode(parentNode); QModelIndex parentIndex = indexForNode(parentNode);
// Old list // Old list
if (newNodeList.isEmpty()) {
qCDebug(logger()) << " newNodeList empty";
return;
}
QHash<FolderNode*, QList<Node*> >::const_iterator it = m_childNodes.constFind(parentNode); QHash<FolderNode*, QList<Node*> >::const_iterator it = m_childNodes.constFind(parentNode);
if (it == m_childNodes.constEnd()) { if (it == m_childNodes.constEnd()) {
if (!parentIndex.isValid()) { if (!parentIndex.isValid()) {