From kde-commits Tue Dec 04 21:57:18 2007 From: =?utf-8?q?Rafael=20Fern=C3=A1ndez=20L=C3=B3pez?= Date: Tue, 04 Dec 2007 21:57:18 +0000 To: kde-commits Subject: KDE/kdelibs/kfile Message-Id: <1196805438.095771.20053.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=119680544410021 SVN commit 744930 by ereslibre: Avoid crashes and make the code more rock-solid M +16 -0 kdiroperator.cpp --- trunk/KDE/kdelibs/kfile/kdiroperator.cpp #744929:744930 @@ -1932,6 +1932,10 @@ const QModelIndex dirIndex = proxyModel->mapToSource(index); KFileItem item = dirModel->itemForIndex(dirIndex); bool selectDir = false; + + if (item.isNull()) + return; + if (item.isDir()) { const Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers(); selectDir = KGlobalSettings::singleClick() && @@ -1954,6 +1958,10 @@ const QModelIndex dirIndex = proxyModel->mapToSource(index); KFileItem item = dirModel->itemForIndex(dirIndex); + + if (item.isNull()) + return; + if (item.isDir()) { parent->selectDir(item); } else { @@ -1985,6 +1993,10 @@ const QModelIndex proxyIndex = itemView->indexAt(pos); const QModelIndex dirIndex = proxyModel->mapToSource(proxyIndex); KFileItem item = dirModel->itemForIndex(dirIndex); + + if (item.isNull()) + return; + parent->activatedMenu(item, QCursor::pos()); } @@ -1993,6 +2005,10 @@ if ((preview != 0) && index.isValid() && (index.column() == KDirModel::Name)) { const QModelIndex dirIndex = proxyModel->mapToSource(index); const KFileItem item = dirModel->itemForIndex(dirIndex); + + if (item.isNull()) + return; + if (!item.isDir()) { previewUrl = item.url(); previewTimer->start(300);