diff options
author | arza <arza@arza.us> | 2019-03-17 02:13:05 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2019-03-18 11:15:10 +0100 |
commit | 6f3f500404d7732c29836884808259eb2162a8ca (patch) | |
tree | dc5c079d01d0a85362af04fbad4cefaf6da1d172 | |
parent | 32f8349fbb1783930bac1734c47bb8c9467e29a5 (diff) | |
download | qutebrowser-6f3f500404d7732c29836884808259eb2162a8ca.tar.gz qutebrowser-6f3f500404d7732c29836884808259eb2162a8ca.zip |
Fix crash in :config-dict-add, :config-dict-remove, :config-list-add and :config-list-remove with invalid option
-rw-r--r-- | qutebrowser/config/configcommands.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/qutebrowser/config/configcommands.py b/qutebrowser/config/configcommands.py index 410d415d5..2eec817f8 100644 --- a/qutebrowser/config/configcommands.py +++ b/qutebrowser/config/configcommands.py @@ -275,7 +275,8 @@ class ConfigCommands: value: The value to append to the end of the list. temp: Add value temporarily until qutebrowser is closed. """ - opt = self._config.get_opt(option) + with self._handle_config_error(): + opt = self._config.get_opt(option) valid_list_types = (configtypes.List, configtypes.ListOrValue) if not isinstance(opt.typ, valid_list_types): raise cmdutils.CommandError(":config-list-add can only be used " @@ -300,7 +301,8 @@ class ConfigCommands: replace: Replace existing values. By default, existing values are not overwritten. """ - opt = self._config.get_opt(option) + with self._handle_config_error(): + opt = self._config.get_opt(option) if not isinstance(opt.typ, configtypes.Dict): raise cmdutils.CommandError(":config-dict-add can only be used " "for dicts") @@ -327,7 +329,8 @@ class ConfigCommands: value: The value to remove from the list. temp: Remove value temporarily until qutebrowser is closed. """ - opt = self._config.get_opt(option) + with self._handle_config_error(): + opt = self._config.get_opt(option) valid_list_types = (configtypes.List, configtypes.ListOrValue) if not isinstance(opt.typ, valid_list_types): raise cmdutils.CommandError(":config-list-remove can only be used " @@ -355,7 +358,8 @@ class ConfigCommands: key: The key to remove from the dict. temp: Remove value temporarily until qutebrowser is closed. """ - opt = self._config.get_opt(option) + with self._handle_config_error(): + opt = self._config.get_opt(option) if not isinstance(opt.typ, configtypes.Dict): raise cmdutils.CommandError(":config-dict-remove can only be used " "for dicts") |