From 913142f9c71a354f96ceddd9c3e78b054c8fc803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Or=C5=A1uli=C4=87?= Date: Mon, 26 Mar 2018 13:47:15 +0000 Subject: [PATCH] Avoid failed CHECK when running offline node with no bags. (#777) Bug introduced in #680. --- cartographer_ros/cartographer_ros/offline_node.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cartographer_ros/cartographer_ros/offline_node.cc b/cartographer_ros/cartographer_ros/offline_node.cc index 7709c50..e5f40e7 100644 --- a/cartographer_ros/cartographer_ros/offline_node.cc +++ b/cartographer_ros/cartographer_ros/offline_node.cc @@ -236,7 +236,11 @@ void RunOfflineNode(const MapBuilderFactory& map_builder_factory) { // TODO(gaschler): Warn if resolved topics are not in bags. std::unordered_map 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;