From 56237aa8f8adaffc63584a6e8435b9cf414d82ef Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 20 Mar 2018 05:35:15 +1100 Subject: [PATCH] Throw when trying to remove a child highlighter that does not exists --- src/highlighter_group.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/highlighter_group.cc b/src/highlighter_group.cc index 1b3ba4156..01a62e9c8 100644 --- a/src/highlighter_group.cc +++ b/src/highlighter_group.cc @@ -39,6 +39,8 @@ void HighlighterGroup::add_child(HighlighterAndId&& hl) void HighlighterGroup::remove_child(StringView id) { + if (not m_highlighters.contains(id)) + throw runtime_error{format("no such child: {}", id)}; m_highlighters.remove(id); }