┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphiniconsview.cpp
diff options
context:
space:
mode:
authorJohn Tapsell <[email protected]>2007-11-27 20:55:02 +0000
committerJohn Tapsell <[email protected]>2007-11-27 20:55:02 +0000
commitedf8be2dffa671faabf0fbf6e93b72441f20da5c (patch)
tree7e7bca05e04d3c901d5d5c7d1f4b52a0b8c85196 /src/dolphiniconsview.cpp
parent428a2064c3ef19e85550b75be0fcdfbf6e53c724 (diff)
Do not crash if the index is not valid.
svn path=/trunk/KDE/kdebase/apps/; revision=742329
Diffstat (limited to 'src/dolphiniconsview.cpp')
-rw-r--r--src/dolphiniconsview.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp
index fbb5f31c6..1e2e66f5a 100644
--- a/src/dolphiniconsview.cpp
+++ b/src/dolphiniconsview.cpp
@@ -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);
}