Skip to content

Commit

Permalink
App::get_options(): Assert correct usage
Browse files Browse the repository at this point in the history
This is intended to catch cases where a developer erroneously includes the leading dash character in the name of a command-line option when invoking the App::get_options() or App::get_option_value() function.
  • Loading branch information
Lestropie committed Nov 6, 2024
1 parent 4d6f20f commit db92957
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,8 @@ void init(int cmdline_argc, const char *const *cmdline_argv) {
}

const std::vector<ParsedOption> get_options(const std::string &name) {
assert(!name.empty());
assert(name[0] != '-');
std::vector<ParsedOption> matches;
for (size_t i = 0; i < option.size(); ++i) {
assert(option[i].opt);
Expand Down

0 comments on commit db92957

Please sign in to comment.