From 2d19b87208b8bf23e8b9e70907665761c633e880 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Thu, 24 Oct 2019 14:43:23 +0200 Subject: [PATCH] Fix potential error when $PATH is not defined When `PATH` is not in `os.environ`, kitty could potentially throw a `KeyError`. --- kitty/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitty/constants.py b/kitty/constants.py index 60cde3731..f2acb3542 100644 --- a/kitty/constants.py +++ b/kitty/constants.py @@ -25,7 +25,7 @@ def kitty_exe(): if ans is None: rpath = sys._xoptions.get('bundle_exe_dir') if not rpath: - items = os.environ['PATH'].split(os.pathsep) + items = filter(None, os.environ.get('PATH', '').split(os.pathsep)) seen = set() for candidate in items: if candidate not in seen: