[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kfile
From:       Rafael Fernández López <ereslibre () kde ! org>
Date:       2007-12-04 21:57:18
Message-ID: 1196805438.095771.20053.nullmailer () svn ! kde ! org
[Download RAW message or body]

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);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic