context: Do not allow show, list or none as new context names

- Thanks to silviof.
This commit is contained in:
Tomas Babej 2017-07-27 19:00:40 +02:00 committed by Paul Beckingham
parent d987c9f5cd
commit 7465410c5a
11 changed files with 16 additions and 1 deletions

View file

@ -137,6 +137,12 @@ void CmdContext::defineContext (const std::vector <std::string>& words, std::str
auto name = "context." + words[1];
auto value = joinWords (words, 2);
// Make sure nobody creates a context with name 'list', 'none' or 'show'
if (words[1] == "none" or words[1] == "list" or words[1] == "show")
{
throw format (STRING_CMD_CONTEXT_DEF_INVLD, words[1]);
}
// Check if the value is a proper filter by filtering current pending.data
Filter filter;
std::vector <Task> filtered;