Don't crash on channels with timestamps but no data
James tried logging timestamps but not the actual data. The logger
merrily logged it, but we were unable to read the log. The code looking
to see if there is supposed to be matching data freaks out because it
doesn't know what the source node is. We can fill that all in a bit
better with no real extra cost, so let's just do that.
We probably don't want to support doing this at all. AOS shouldn't let
you create configs like that.
Change-Id: Ia8978a12a5251ce72c271e7bc8c2dcea4c185164
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/events/logging/log_reader.cc b/aos/events/logging/log_reader.cc
index f306492..169311e 100644
--- a/aos/events/logging/log_reader.cc
+++ b/aos/events/logging/log_reader.cc
@@ -586,9 +586,7 @@
event_loop, node,
logged_configuration()->channels()->Get(logged_channel_index));
- if (channel->logger() == LoggerConfig::NOT_LOGGED) {
- continue;
- }
+ const bool logged = channel->logger() != LoggerConfig::NOT_LOGGED;
message_bridge::NoncausalOffsetEstimator *filter = nullptr;
@@ -611,12 +609,13 @@
configuration::ChannelIsSendableOnNode(channel, node) &&
configuration::ConnectionCount(channel);
- state->SetChannel(logged_channel_index,
- configuration::ChannelIndex(configuration(), channel),
- event_loop ? event_loop->MakeRawSender(channel) : nullptr,
- filter, is_forwarded, source_state);
+ state->SetChannel(
+ logged_channel_index,
+ configuration::ChannelIndex(configuration(), channel),
+ event_loop && logged ? event_loop->MakeRawSender(channel) : nullptr,
+ filter, is_forwarded, source_state);
- if (is_forwarded) {
+ if (is_forwarded && logged) {
const Node *source_node = configuration::GetNode(
configuration(), channel->source_node()->string_view());