Fix crashes in median() if all spans in a level are short (#1668)
parent
02594a07c7
commit
47b80c9a3f
|
@ -188,8 +188,13 @@ std::vector<Floor> FindFloors(const proto::Trajectory& trajectory,
|
|||
common::FromUniversal(
|
||||
trajectory.node(span.end_index - 1).timestamp())});
|
||||
}
|
||||
if (!z_values.empty()) {
|
||||
std::sort(z_values.begin(), z_values.end());
|
||||
floors.back().z = Median(z_values);
|
||||
} else {
|
||||
LOG(ERROR) << "All spans in level are short";
|
||||
floors.pop_back();
|
||||
}
|
||||
}
|
||||
return floors;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue