From c4a9f059dcd8359051c551592b80aa3d8d70f5c6 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 2 Dec 2015 19:25:40 +0000 Subject: [PATCH] Fix unset option when using the current scope and it points to global --- src/commands.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands.cc b/src/commands.cc index 4f85e641..d468dc59 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -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]); } };