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;