Skip to content

Commit

Permalink
AP_InertialSensor: SITL: call logging singleton methods only if avail…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
peterbarker authored and tridge committed Jan 3, 2024
1 parent 3ed8a43 commit 68d8a26
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libraries/AP_InertialSensor/AP_InertialSensor_SITL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,12 @@ void AP_InertialSensor_SITL::read_gyro_from_file()

if (ret <= 0) {
if (sitl->gyro_file_rw == SITL::SIM::INSFileMode::INS_FILE_READ_STOP_ON_EOF) {
#if HAL_LOGGING_ENABLED
//stop logging
if (AP_Logger::get_singleton()) {
AP::logger().StopLogging();
}
#endif
exit(0);
}
lseek(gyro_fd, 0, SEEK_SET);
Expand Down Expand Up @@ -492,10 +494,12 @@ void AP_InertialSensor_SITL::read_accel_from_file()

if (ret <= 0) {
if (sitl->accel_file_rw == SITL::SIM::INSFileMode::INS_FILE_READ_STOP_ON_EOF) {
#if HAL_LOGGING_ENABLED
//stop logging
if (AP_Logger::get_singleton()) {
AP::logger().StopLogging();
}
#endif
exit(0);
}
lseek(accel_fd, 0, SEEK_SET);
Expand Down

0 comments on commit 68d8a26

Please sign in to comment.