Handle missing IP address in conf properly

pull/1186/head
Stephen Shelton 4 years ago
parent 0697d57190
commit 28c1ca9c7a
No known key found for this signature in database
GPG Key ID: EE4BADACCE8B631C

@ -94,9 +94,14 @@ namespace llarp
conf.defineOption<std::string>("router", "public-address", false, "",
[this](std::string arg) {
llarp::LogInfo("public ip ", arg, " size ", arg.size());
if(arg.size() < 17)
if (not arg.empty())
{
llarp::LogInfo("public ip ", arg, " size ", arg.size());
if(arg.size() > 16)
throw std::invalid_argument(stringify("Not a valid IPv4 addr: ", arg));
// assume IPv4
llarp::Addr a(arg);
llarp::LogInfo("setting public ipv4 ", a);

Loading…
Cancel
Save