diff --git a/src/connectionmanager.cpp b/src/connectionmanager.cpp
index 3fc8e9f46929ba0d1d50cfdaee9518beef7b8f1c..d65d0726b48bf93b0c800e4b659fe8d3e8e252b1 100644
--- a/src/connectionmanager.cpp
+++ b/src/connectionmanager.cpp
@@ -262,6 +262,8 @@ struct DeviceInfo {
                     ret.emplace_back(std::move(cb));
                     it = connecting.erase(it);
                 }
+            } else {
+                ++it;
             }
         }
         for (auto it = waiting.begin(); it != waiting.end();) {
@@ -276,6 +278,8 @@ struct DeviceInfo {
                     ret.emplace_back(std::move(cb));
                     it = waiting.erase(it);
                 }
+            } else {
+                ++it;
             }
         }
         return {ret, retry};