diff --git a/threaddata.cpp b/threaddata.cpp index 55a3aff..47cef0a 100644 --- a/threaddata.cpp +++ b/threaddata.cpp @@ -294,7 +294,13 @@ void ThreadData::giveClient(std::shared_ptr client) std::shared_ptr ThreadData::getClient(int fd) { std::lock_guard lck(clients_by_fd_mutex); - return this->clients_by_fd[fd]; + + auto pos = clients_by_fd.find(fd); + + if (pos == clients_by_fd.end()) + return std::shared_ptr(); + + return pos->second; } void ThreadData::removeClientQueued(const std::shared_ptr &client)