Skip to content

Commit 3c38e65

Browse files
[Fix] Invalid setting value for auto_open_doc_panel_on_navigate.
This commit fixes a situation where invalid setting value could be used for `auto_open_doc_panel_on_navigate`. It now does proper logging and falls back to the default value.
1 parent ed922fb commit 3c38e65

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/commands/commands_browser_core_commands.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ def on_select(self, idx, event, commands_data):
9090

9191
if modifier_key in event["modifier_keys"]:
9292
command_data = list(commands_data)[idx]
93-
type = command_data[1]["command_type"]
93+
command_type = command_data[1]["command_type"]
9494

95-
if type == "text":
95+
if command_type == "text":
9696
final_string = f"view.run_command("
97-
if type == "application":
97+
if command_type == "application":
9898
final_string = f"sublime.run_command("
99-
if type in ["window", "find"]:
99+
if command_type in ["window", "find"]:
100100
final_string = f"window.run_command("
101101

102102
if not command_data[1].get("args"):
@@ -129,7 +129,15 @@ def on_highlight(self, idx, commands_data):
129129
"""
130130
if idx < 0:
131131
return
132-
if commands_browser_settings("auto_open_doc_panel_on_navigate"):
132+
133+
auto_open = commands_browser_settings("auto_open_doc_panel_on_navigate")
134+
135+
if (type(auto_open) != bool):
136+
log(f"""'{auto_open}' is an invalid value for the setting
137+
'auto_open_doc_panel_on_navigate'. Falling back to default value.""")
138+
auto_open = False
139+
140+
if auto_open:
133141
core_commands_doc_panel(self.window, list(commands_data)[idx])
134142

135143

0 commit comments

Comments
 (0)