Fix division-by-zero crash

Not clear why step_->jobsets was empty...
This commit is contained in:
Eelco Dolstra 2015-10-30 18:01:48 +01:00
parent 1ff48da3d3
commit d8d188301d

View file

@ -136,10 +136,12 @@ bool State::doBuildStep(std::shared_ptr<StoreAPI> store, Step::ptr step,
among the jobsets that depend on it. */ among the jobsets that depend on it. */
{ {
auto step_(step->state.lock()); auto step_(step->state.lock());
// FIXME: loss of precision. if (!step_->jobsets.empty()) {
time_t charge = (result.stopTime - result.startTime) / step_->jobsets.size(); // FIXME: loss of precision.
for (auto & jobset : step_->jobsets) time_t charge = (result.stopTime - result.startTime) / step_->jobsets.size();
jobset->addStep(result.startTime, charge); for (auto & jobset : step_->jobsets)
jobset->addStep(result.startTime, charge);
}
} }
/* Asynchronously compress the log. */ /* Asynchronously compress the log. */