Skip to content
Snippets Groups Projects
Commit 95b93057 authored by Guillaume Roguez's avatar Guillaume Roguez Committed by Kateryna Kostiuk
Browse files

BannedContactModel: prevent remove() call with invalid args


The application crashes if the ContactMethod given to
BannedContactModel::remove() doesn't exist in the banned list.
Check for existance and no-op if not.

Change-Id: Ifde1c1b9a0c369889c8dabfce20dd8d8937b715b
Reviewed-by: default avatarKateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
parent 8793d7c5
Branches
No related tags found
No related merge requests found
......@@ -152,6 +152,8 @@ void
BannedContactModel::remove(ContactMethod* cm)
{
auto rowIndex = d_ptr->m_lBanned.indexOf(cm);
if (rowIndex < 0)
return;
beginRemoveRows(QModelIndex(), rowIndex, rowIndex);
d_ptr->m_lBanned.removeAt(rowIndex);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment