diff --git a/rosbag2_transport/src/rosbag2_transport/recorder.cpp b/rosbag2_transport/src/rosbag2_transport/recorder.cpp index 4aa0b1b79a..b5092d4a9a 100644 --- a/rosbag2_transport/src/rosbag2_transport/recorder.cpp +++ b/rosbag2_transport/src/rosbag2_transport/recorder.cpp @@ -211,7 +211,9 @@ RecorderImpl::RecorderImpl( RecorderImpl::~RecorderImpl() { keyboard_handler_->delete_key_press_callback(toggle_paused_key_callback_handle_); - stop(); + if (in_recording_) { + stop(); + } } void RecorderImpl::stop()