From 3934e79bb26d5685331f74356e10b5a30ca63416 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 16 May 2017 11:01:32 +0200 Subject: [PATCH] Add error check in bc retriever --- lib/src/BitcodeRetriever.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/src/BitcodeRetriever.cpp b/lib/src/BitcodeRetriever.cpp index 4e19123..cdb79a0 100644 --- a/lib/src/BitcodeRetriever.cpp +++ b/lib/src/BitcodeRetriever.cpp @@ -231,6 +231,12 @@ class BitcodeRetriever::Impl { std::move(containers->begin(), containers->end(), std::back_inserter(bitcodeContainers)); } + // Don't forget to check error one last time, in case there were no + // children and body of the for loop was never executed. + if (err) { + return std::move(err); + } + return std::move(bitcodeContainers); }