From 59bd6e87a44fab86c511f78ff50f3e3c4cca4b59 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 9 Oct 2020 21:55:59 +0200 Subject: [PATCH] Completions::add(): Guard against newlines --- src/libutil/args.cc | 9 +++++---- 1 file 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