trace_processor: ignore empty SQL queries in the shell
Bug: 120487929
Change-Id: I75a574fd171e34c7b08a639ff1b1038ee758e03c
diff --git a/src/trace_processor/trace_processor_shell.cc b/src/trace_processor/trace_processor_shell.cc
index 51b4579..f4810db 100644
--- a/src/trace_processor/trace_processor_shell.cc
+++ b/src/trace_processor/trace_processor_shell.cc
@@ -347,6 +347,13 @@
}
if (sql_query.back() == '\n')
sql_query.resize(sql_query.size() - 1);
+
+ // If we have a new line at the end of the file or an extra new line
+ // somewhere in the file, we'll end up with an empty query which we should
+ // just ignore.
+ if (sql_query.empty())
+ continue;
+
PERFETTO_ILOG("Executing query: %s", sql_query.c_str());
protos::RawQueryArgs query;