diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-06-03 12:14:33 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-06-04 11:08:00 +0200 |
commit | fa910b47656d0e69cccb1f31804f2b11aa45d053 (patch) | |
tree | 5d2084e49b3408554a4cdf5c856b9c3330170705 /src/util | |
parent | a9435e34457e0bfebd22e574fe63428537948aeb (diff) |
util: Properly handle -noincludeconf on command line
This bug was introduced in commit
fad0867d6ab9430070aa7d60bf7617a6508e0586.
Unit test
Co-Authored-By: Russell Yanofsky <russ@yanofsky.org>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/system.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp index 5b87806a45..13ccf7463e 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -365,11 +365,14 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin m_settings.command_line_options[key].push_back(value); } - // we do not allow -includeconf from command line + // we do not allow -includeconf from command line, only -noincludeconf if (auto* includes = util::FindKey(m_settings.command_line_options, "includeconf")) { - const auto& include{*util::SettingsSpan(*includes).begin()}; // pick first value as example - error = "-includeconf cannot be used from commandline; -includeconf=" + include.write(); - return false; + const util::SettingsSpan values{*includes}; + // Range may be empty if -noincludeconf was passed + if (!values.empty()) { + error = "-includeconf cannot be used from commandline; -includeconf=" + values.begin()->write(); + return false; // pick first value as example + } } return true; } |