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: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F5863%2Fhead;p=thirdparty%2Fpdns.git dnsdist: avoid crash when printing nullptr retvals --- diff --git a/pdns/dnsdist-console.cc b/pdns/dnsdist-console.cc index 88ec89867d..2ab19c3b03 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";