Fix unset option when using the current scope and it points to global

This commit is contained in:
Maxime Coste 2015-12-02 19:25:40 +00:00
parent 2a6f36732d
commit c4a9f059dc

View File

@ -1085,10 +1085,10 @@ const CommandDesc unset_option_cmd = {
},
[](const ParametersParser& parser, Context& context, const ShellContext&)
{
if (parser[0] == "global")
auto& options = get_options(parser[0], context, parser[1]);
if (&options == &GlobalScope::instance().options())
throw runtime_error("Cannot unset options in global scope");
get_options(parser[0], context, parser[1]).unset_option(parser[1]);
options.unset_option(parser[1]);
}
};