Avoid failed CHECK when running offline node with no bags. (#777)

Bug introduced in #680.
master
Juraj Oršulić 2018-03-26 13:47:15 +00:00 committed by gaschler
parent 881fa76150
commit 913142f9c7
1 changed files with 5 additions and 1 deletions

View File

@ -236,7 +236,11 @@ void RunOfflineNode(const MapBuilderFactory& map_builder_factory) {
// TODO(gaschler): Warn if resolved topics are not in bags.
std::unordered_map<int, int> bag_index_to_trajectory_id;
const ros::Time begin_time = playable_bag_multiplexer.PeekMessageTime();
const ros::Time begin_time =
// If no bags were loaded, we cannot peek the time of first message.
playable_bag_multiplexer.IsMessageAvailable()
? playable_bag_multiplexer.PeekMessageTime()
: ros::Time();
while (playable_bag_multiplexer.IsMessageAvailable()) {
if (!::ros::ok()) {
return;