From 6f3f500404d7732c29836884808259eb2162a8ca Mon Sep 17 00:00:00 2001 From: arza Date: Sun, 17 Mar 2019 02:13:05 +0200 Subject: Fix crash in :config-dict-add, :config-dict-remove, :config-list-add and :config-list-remove with invalid option --- qutebrowser/config/configcommands.py | 12 ++++++++---- 1 file 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") -- cgit v1.2.3-54-g00ecf