Only add node to the log file when needed
We were adding an empty node to the log file when run in a single-node
setup. Add a test and don't add a node instead.
Change-Id: I9c579140705adb7e85aaf3e17e1dea75bf75776d
diff --git a/aos/configuration.cc b/aos/configuration.cc
index 65c218e..46f07ac 100644
--- a/aos/configuration.cc
+++ b/aos/configuration.cc
@@ -603,7 +603,10 @@
}
const Node *GetNode(const Configuration *config, std::string_view name) {
+ CHECK(config->has_nodes())
+ << ": Asking for a node from a single node configuration.";
for (const Node *node : *config->nodes()) {
+ CHECK(node->has_name()) << ": Malformed node " << FlatbufferToJson(node);
if (node->name()->string_view() == name) {
return node;
}