cabana: fix crash when no can events in the log
diff --git a/tools/cabana/streams/abstractstream.cc b/tools/cabana/streams/abstractstream.cc
index 8887084578d1c8..a8c16ca267b9ea 100644
--- a/tools/cabana/streams/abstractstream.cc
+++ b/tools/cabana/streams/abstractstream.cc
@@ -170,7 +170,7 @@ void AbstractStream::mergeEvents(std::vector<Event *>::const_iterator first, std
   auto insert_pos = std::upper_bound(all_events_.cbegin(), all_events_.cend(), new_events.front(), compare);
   all_events_.insert(insert_pos, new_events.cbegin(), new_events.cend());
 
-  lastest_event_ts = all_events_.back()->mono_time;
+  lastest_event_ts = all_events_.empty() ? 0 : all_events_.back()->mono_time;
   emit eventsMerged();
 }
 
