diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/accountregistry.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/accountregistry.cpp b/lib/accountregistry.cpp index ab8c46e3..f25369d6 100644 --- a/lib/accountregistry.cpp +++ b/lib/accountregistry.cpp @@ -21,10 +21,11 @@ void AccountRegistry::add(Connection* a) void AccountRegistry::drop(Connection* a) { - const auto idx = indexOf(a); - beginRemoveRows(QModelIndex(), idx, idx); - remove(idx); - endRemoveRows(); + if (const auto idx = indexOf(a); idx != -1) { + beginRemoveRows(QModelIndex(), idx, idx); + remove(idx); + endRemoveRows(); + } Q_ASSERT(!contains(a)); } |