diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-10-09 21:55:59 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-10-09 21:55:59 +0200 |
commit | 59bd6e87a44fab86c511f78ff50f3e3c4cca4b59 (patch) | |
tree | a0ac4909a218bd6caa54fa832dd7bcdc76cdba4a | |
parent | ea4b2b985f4c178ac86dfb1000aedddc17b4df61 (diff) |
Completions::add(): Guard against newlines
-rw-r--r-- | src/libutil/args.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libutil/args.cc b/src/libutil/args.cc index 66d8df085..8bd9c8aeb 100644 --- a/src/libutil/args.cc +++ b/src/libutil/args.cc @@ -19,10 +19,11 @@ void Args::addFlag(Flag && flag_) void Completions::add(std::string completion, std::string description) { - insert(Completion{ - .completion = completion, - .description = description - }); + assert(description.find('\n') == std::string::npos); + insert(Completion { + .completion = completion, + .description = description + }); } bool Completion::operator<(const Completion & other) const |