Fix potential error when $PATH is not defined

When `PATH` is not in `os.environ`, kitty could potentially throw a `KeyError`.
This commit is contained in:
Luflosi 2019-10-24 14:43:23 +02:00
parent 54ca775006
commit 2d19b87208
No known key found for this signature in database
GPG Key ID: 14140F703B7D8362

View File

@ -25,7 +25,7 @@ def kitty_exe():
if ans is None: if ans is None:
rpath = sys._xoptions.get('bundle_exe_dir') rpath = sys._xoptions.get('bundle_exe_dir')
if not rpath: if not rpath:
items = os.environ['PATH'].split(os.pathsep) items = filter(None, os.environ.get('PATH', '').split(os.pathsep))
seen = set() seen = set()
for candidate in items: for candidate in items:
if candidate not in seen: if candidate not in seen: