Fix loggers running out of space
Change-Id: Ic2b5bcc0c2ae475404658aa35904f19edb7c5ce7
diff --git a/aos/events/logging/logfile_utils.h b/aos/events/logging/logfile_utils.h
index d251772..5fe45a5 100644
--- a/aos/events/logging/logfile_utils.h
+++ b/aos/events/logging/logfile_utils.h
@@ -107,7 +107,12 @@
void Close();
// Returns the total number of bytes written and currently queued.
- size_t total_bytes() const { return encoder_->total_bytes(); }
+ size_t total_bytes() const {
+ if (!encoder_) {
+ return 0;
+ }
+ return encoder_->total_bytes();
+ }
// The maximum time for a single write call, or 0 if none have been performed.
std::chrono::nanoseconds max_write_time() const { return max_write_time_; }