From 76cb2e8caf3655f331b05dce9a8d91222c903666 Mon Sep 17 00:00:00 2001 From: scwatts Date: Mon, 29 May 2017 12:35:05 +1000 Subject: [PATCH] Wrapped warnings in if statement as needed --- src/fastspar.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/fastspar.cpp b/src/fastspar.cpp index dfabdda..1584678 100644 --- a/src/fastspar.cpp +++ b/src/fastspar.cpp @@ -34,16 +34,18 @@ int main(int argc, char **argv) { } // Print warnings - fprintf(stderr, "\nWarning: the following OTUs have only one unique permutation and it is recommended to remove them from this analysis:\n"); - for (auto &i : invariant_otus) { - fprintf(stderr, "\t%s (row %d)\n", otu_table.otu_ids[i].c_str(), i); - } - fprintf(stderr, "\n"); + if (! invariant_otus.empty()) { + fprintf(stderr, "\nWarning: the following OTUs have only one unique permutation and it is recommended to remove them from this analysis:\n"); + for (auto &i : invariant_otus) { + fprintf(stderr, "\t%s (row %d)\n", otu_table.otu_ids[i].c_str(), i); + } + fprintf(stderr, "\n"); - // Prompt user for continue - if (! fastspar_options.assume_yes) { - if (continue_exit_prompt() == false) { - return 0; + // Prompt user for continue + if (! fastspar_options.assume_yes) { + if (continue_exit_prompt() == false) { + return 0; + } } }