summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Maennich <maennich@google.com>2021-11-24 16:01:04 +0000
committerMatthias Maennich <maennich@google.com>2021-11-24 16:04:12 +0000
commita0a2eca344e33c8c7d0283f89f688e1b832b0ba9 (patch)
tree94c3360535727492733518218f78cc17f54d3171
parent7b413cd0e86858aefe58b791f3e9ededa891231f (diff)
downloadbuild-tools-a0a2eca344e33c8c7d0283f89f688e1b832b0ba9.tar.gz
interceptor: protect from unexpectedly empty argument lists
Signed-off-by: Matthias Maennich <maennich@google.com> Change-Id: Iab3179321d4c727d741d0dee96e3b2c7440201fb
-rw-r--r--interceptor/analysis.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/interceptor/analysis.cc b/interceptor/analysis.cc
index 1527a43..03292af 100644
--- a/interceptor/analysis.cc
+++ b/interceptor/analysis.cc
@@ -133,6 +133,10 @@ void compdb_to_file(const interceptor::Log& log, const fs::path& output) {
interceptor::CompilationDatabase compdb;
for (const auto& command : log.commands()) {
+ if (command.arguments().empty()) {
+ continue;
+ }
+
// skip anything that is not a compiler invocation
if (!kCompilers.count(fs::path(command.arguments(0)).filename().native())) {
continue;