]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Do not crash if the index is not valid.
authorJohn Tapsell <john.tapsell@kdemail.net>
Tue, 27 Nov 2007 20:55:02 +0000 (20:55 +0000)
committerJohn Tapsell <john.tapsell@kdemail.net>
Tue, 27 Nov 2007 20:55:02 +0000 (20:55 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=742329

src/dolphiniconsview.cpp

index fbb5f31c6f9c2e8d23ab8ffbdb3e6543b6328ffd..1e2e66f5aa6a7d92bf473b7a2f45a91caf8b8a0a 100644 (file)
@@ -214,10 +214,18 @@ void DolphinIconsView::dragMoveEvent(QDragMoveEvent* event)
     // TODO: remove this code when the issue #160611 is solved in Qt 4.4
     const QModelIndex index = indexAt(event->pos());
     setDirtyRegion(m_dropRect);
-    if (itemForIndex(index).isDir()) {
-        m_dropRect = visualRect(index);
-    } else {
+
+    if(!index.isValid()) {
         m_dropRect.setSize(QSize()); // set as invalid
+    } else {
+        KFileItem item = itemForIndex(index);
+        if (item.isNull()) {
+            kWarning(7007) << "Invalid item returned for index";
+        } else if (itemForIndex(index).isDir()) {
+            m_dropRect = visualRect(index);
+        } else {
+            m_dropRect.setSize(QSize()); // set as invalid
+       }
     }
     setDirtyRegion(m_dropRect);
 }