summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-08-31 14:57:11 +1000
committerMichael Brasser <michael.brasser@nokia.com>2010-08-31 14:57:11 +1000
commit7c2207640a65dc59a420ebf71a45e38350840313 (patch)
tree9eb43fa3b92043326a75c0916fc9e7e4454befd2
parent19d2736f143dd9272c4d68c633a574ea059ed19c (diff)
Return early when from == to in move(from, to).
-rw-r--r--qobjectlistmodel.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/qobjectlistmodel.cpp b/qobjectlistmodel.cpp
index 92b4646..0ac41d7 100644
--- a/qobjectlistmodel.cpp
+++ b/qobjectlistmodel.cpp
@@ -228,7 +228,8 @@ void QObjectListModel::replace(int i, QObject *object)
void QObjectListModel::move(int from, int to)
{
- beginMoveRows(QModelIndex(), from, from, QModelIndex(), to > from ? to+1 : to);
+ if (!beginMoveRows(QModelIndex(), from, from, QModelIndex(), to > from ? to+1 : to))
+ return; //should only be triggered for our simple case if from == to.
m_objects.move(from, to);
endMoveRows();
}