From 34e6d5fee66b8c65a1827c473ff598880cea1883 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 6 Nov 2015 16:25:11 -0500 Subject: [PATCH] Exit editSub with unset or empty $EDITOR --- sub.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sub.py b/sub.py index a0270c1..5708a89 100755 --- a/sub.py +++ b/sub.py @@ -39,7 +39,11 @@ def editSub(num): sub = getSub(getItem(num)) if sub is None: sys.exit("This item does not have a sub") - editor = os.getenv("EDITOR").split() + editor = os.getenv("EDITOR") + if editor is not None and editor != "": + editor = editor.split() + else: + sys.exit("$EDITOR is unset, cannot edit") subprocess.call(editor + [os.path.join(os.getenv("TODO_DIR"), sub[0], sub[1])]) def showSub(item, indent=0, color=True):