Mercurial > trustbridge
diff ui/certificatetablemodel.cpp @ 1316:ff9cd05e861e
(issue166) Fix certificiate removal
The index that should be removed came from the filter proxy model
and did not map to the real index. This was broken.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 13 Oct 2014 17:23:35 +0200 |
parents | 320a64d58e62 |
children |
line wrap: on
line diff
--- a/ui/certificatetablemodel.cpp Mon Oct 13 16:19:28 2014 +0200 +++ b/ui/certificatetablemodel.cpp Mon Oct 13 17:23:35 2014 +0200 @@ -34,11 +34,11 @@ const QModelIndex &index) { beginRemoveRows(QModelIndex(), row, row + count - 1); - if ((row + count - 1) > mCertificates.size()) { + if (count < 0 || row < 0 || (row + count) > mCertificates.size()) { return false; } - for (int i = row + count - 1; i >= row; i--) { - mCertificates.removeAt(i); + for (int i = 0; i < count; ++i) { + mCertificates.removeAt(row); } endRemoveRows(); return true;