// 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 {
- m_dropRect.setSize(QSize()); // set as invalid
+
+ m_dropRect.setSize(QSize()); // set as invalid
+ if (index.isValid()) {
+ const KFileItem item = itemForIndex(index);
+ if (!item.isNull() && item.isDir()) {
+ m_dropRect = visualRect(index);
+ }
}
setDirtyRegion(m_dropRect);
}
m_dragging = false;
} else {
m_dragging = true;
- if (itemForIndex(index).isDir()) {
+ const KFileItem item = itemForIndex(index);
+ if (!item.isNull() && item.isDir()) {
m_dropRect = visualRect(index);
} else {
m_dropRect.setSize(QSize()); // set as invalid
const QModelIndex index = indexAt(event->pos());
setDirtyRegion(m_dropRect);
- 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.setSize(QSize()); // set as invalid
+ if (index.isValid()) {
+ const KFileItem item = itemForIndex(index);
+ if (!item.isNull() && item.isDir()) {
m_dropRect = visualRect(index);
- } else {
- m_dropRect.setSize(QSize()); // set as invalid
- }
+ }
}
setDirtyRegion(m_dropRect);
}