From 1e18995b8e890ef7b92c62c688e88d2c30e9f550 Mon Sep 17 00:00:00 2001 From: MatejKastak Date: Sat, 30 Mar 2024 10:37:58 +0100 Subject: [PATCH] chore: Handle the case where samples_dir has no value A crash from the user was reported. --- yls/debugger.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yls/debugger.py b/yls/debugger.py index c6edc88..8640d5f 100644 --- a/yls/debugger.py +++ b/yls/debugger.py @@ -105,6 +105,9 @@ def display_py_object(value: Any) -> str: async def get_samples_dir(ls: Any) -> Path | None: samples_dir_config = await utils.get_config_from_editor(ls, "yls.yari.samplesDirectory") log.debug(f"[DEBUGGER] Got {samples_dir_config=}") + if not samples_dir_config: + return None + samples_dir_path = Path(samples_dir_config).expanduser().resolve() log.debug(f"[DEBUGGER] Resolved {samples_dir_config=}")