diff --git a/scan_engine.cc b/scan_engine.cc index f8cf9bad6..1ef80a7f0 100644 --- a/scan_engine.cc +++ b/scan_engine.cc @@ -4203,7 +4203,7 @@ static bool do_one_select_round(UltraScanInfo *USI, struct timeval *stime) { std::list::iterator nextProbeI; for (std::list::iterator probeI = host->probes_outstanding.begin(), end = host->probes_outstanding.end(); - probeI != end && numGoodSD < selectres; probeI = nextProbeI) { + probeI != end && numGoodSD < selectres && host->num_probes_outstanding() > 0; probeI = nextProbeI) { /* handleConnectResult may remove the probe at probeI, which invalidates * the iterator. We copy and increment it here instead of in the for-loop * statement to avoid incrementing an invalid iterator */