Fix potential null-dereference in current_time()

This commit is contained in:
Tim Wojtulewicz 2019-05-23 15:41:42 -07:00
parent 7efc39d228
commit 965a99a781

View file

@ -1507,13 +1507,11 @@ double current_time(bool real)
double t = double(tv.tv_sec) + double(tv.tv_usec) / 1e6;
const iosource::Manager::PktSrcList& pkt_srcs(iosource_mgr->GetPktSrcs());
if ( ! pseudo_realtime || real || pkt_srcs.empty() )
if ( ! pseudo_realtime || real || ! iosource_mgr || iosource_mgr->GetPktSrcs().empty() )
return t;
// This obviously only works for a single source ...
iosource::PktSrc* src = pkt_srcs.front();
iosource::PktSrc* src = iosource_mgr->GetPktSrcs().front();
if ( net_is_processing_suspended() )
return src->CurrentPacketTimestamp();