diff --git a/libraries/networking/src/udt/Socket.cpp b/libraries/networking/src/udt/Socket.cpp index a7dd6377ba..a280a68716 100644 --- a/libraries/networking/src/udt/Socket.cpp +++ b/libraries/networking/src/udt/Socket.cpp @@ -128,8 +128,8 @@ Connection& Socket::findOrCreateConnection(const HifiSockAddr& sockAddr) { auto it = _connectionsHash.find(sockAddr); if (it == _connectionsHash.end()) { - it = _connectionsHash.insert(it, std::make_pair(sockAddr, - std::unique_ptr(new Connection(this, sockAddr, _ccFactory->create())))); + auto connection = std::unique_ptr(new Connection(this, sockAddr, _ccFactory->create())); + it = _connectionsHash.insert(it, std::make_pair(sockAddr, std::move(connection))); } return *it->second;