diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp
index 416a8f5039a30c932ccdb1d3cb10745c6df7f864..7a9194bd92a1e9899b5a6141d3061861f9aea1f0 100644
--- a/src/dht_proxy_server.cpp
+++ b/src/dht_proxy_server.cpp
@@ -142,7 +142,8 @@ DhtProxyServer::stop()
     logger_->d("[restinio] closing http server async operations");
     httpServer_->io_context().reset();
     httpServer_->io_context().stop();
-    httpServerThread_.join();
+    if (httpServerThread_.joinable())
+        httpServerThread_.join();
     logger_->d("[restinio] http server closed");
 }