From: Chris Hofstaedtler Date: Thu, 26 Oct 2017 21:43:37 +0000 (+0200) Subject: dnsdist: avoid crash when printing nullptr retvals X-Git-Tag: rec-4.1.0-rc2~13^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6d54c50c707b733b82ffd773a3619240f97687de;p=pdns dnsdist: avoid crash when printing nullptr retvals --- diff --git a/pdns/dnsdist-console.cc b/pdns/dnsdist-console.cc index 88ec89867..2ab19c3b0 100644 --- a/pdns/dnsdist-console.cc +++ b/pdns/dnsdist-console.cc @@ -215,10 +215,14 @@ void doConsole() >(withReturn ? ("return "+line) : line); if(ret) { if (const auto dsValue = boost::get>(&*ret)) { - cout<<(*dsValue)->getName()<getName()<(&*ret)) { - cout<<(*csValue)->local.toStringWithPort()<local.toStringWithPort()<(&*ret)) { cout<<*strValue<>(&*ret)) { - response=(*dsValue)->getName()+"\n"; + if (*dsValue) { + response=(*dsValue)->getName()+"\n"; + } else { + response=""; + } } else if (const auto csValue = boost::get(&*ret)) { - response=(*csValue)->local.toStringWithPort()+"\n"; + if (*csValue) { + response=(*csValue)->local.toStringWithPort()+"\n"; + } else { + response=""; + } } else if (const auto strValue = boost::get(&*ret)) { response=*strValue+"\n";