diff --git a/include/sqlpp11/connection_pool.h b/include/sqlpp11/connection_pool.h index 14e4e81b..e2d057fa 100644 --- a/include/sqlpp11/connection_pool.h +++ b/include/sqlpp11/connection_pool.h @@ -173,12 +173,14 @@ namespace sqlpp pool_connection get_connection() { - std::lock_guard lock(connection_pool_mutex); - if (!free_connections.empty()) { - auto connection = std::move(free_connections.top()); - free_connections.pop(); - return pool_connection(connection, this); + std::lock_guard lock(connection_pool_mutex); + if (!free_connections.empty()) + { + auto connection = std::move(free_connections.top()); + free_connections.pop(); + return pool_connection(connection, this); + } } try