diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 65180d6139..13127761d3 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -241,8 +241,9 @@ UniValue setban(const UniValue& params, bool fHelp) if (!isSubnet) { std::vector resolved; - LookupHost(params[0].get_str().c_str(), resolved, 1, false); - netAddr = resolved[0]; + if (LookupHost(params[0].get_str().c_str(), resolved, 1, false)) { + netAddr = resolved[0]; + } } else LookupSubNet(params[0].get_str().c_str(), subNet);