diff --git a/src/bootstrapmodel.cpp b/src/bootstrapmodel.cpp
index 6617ae34ffa188bcddc8a816bf1582e86823d80c..e1de3cec361e918b0a2ddcd4c70fef75e48969c7 100644
--- a/src/bootstrapmodel.cpp
+++ b/src/bootstrapmodel.cpp
@@ -66,7 +66,9 @@ bool BootstrapModelPrivate::save()
       Lines* l = m_lines[i];
       if (l->hostname.isEmpty() && l->port == -1) {
          q_ptr->beginRemoveRows(QModelIndex(),i,i);
-         m_lines.removeAll(l);
+         const int idx = m_lines.indexOf(l);
+         if (idx >= 0)
+            m_lines.removeAt(idx);
          q_ptr->endRemoveRows();
          val = false;
       }