From 5c1b5816d483e4baa9005b75c1dbc140fe19c304 Mon Sep 17 00:00:00 2001 From: hagen Date: Wed, 10 Feb 2016 00:00:00 +0000 Subject: [PATCH] * fix segfault when offline (#330) --- Tunnel.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tunnel.cpp b/Tunnel.cpp index dbe87a2f..f7102327 100644 --- a/Tunnel.cpp +++ b/Tunnel.cpp @@ -666,6 +666,10 @@ namespace tunnel { // trying to create one more inbound tunnel auto router = i2p::data::netdb.GetRandomRouter (); + if (!router) { + LogPrint (eLogWarning, "Tunnel: can't find any router, skip creating tunnel"); + return; + } LogPrint (eLogDebug, "Tunnel: creating one hop inbound tunnel"); CreateTunnel ( std::make_shared (std::vector > { router->GetRouterIdentity () })