diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp
index 2d50ece9b5aa06df8efebcd09698a4af42cba073..7a41d45b59365d18ad1630752cfcec4cefc81c23 100644
--- a/src/dht_proxy_server.cpp
+++ b/src/dht_proxy_server.cpp
@@ -1030,6 +1030,8 @@ DhtProxyServer::put(restinio::request_handle_t request,
 #endif
                 } else {
                     if (not sessionId.empty()) {
+                        if (not pput.sessionCtx)
+                            pput.sessionCtx = std::make_shared<PushSessionContext>();
                         std::lock_guard<std::mutex> l(pput.sessionCtx->lock);
                         pput.sessionCtx->sessionId = sessionId;
                     }