From 874f0eaad10d384f92108488a34626f86f03c8c0 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Thu, 13 Dec 2012 10:35:05 +0100 Subject: [PATCH] prevent an error when no search string is given --- mutt-ldap.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mutt-ldap.py b/mutt-ldap.py index 05df6f1..4117177 100755 --- a/mutt-ldap.py +++ b/mutt-ldap.py @@ -157,6 +157,10 @@ def cache_persist(query, addresses): if __name__ == '__main__': import sys + if len(sys.argv) < 2: + sys.stderr.write('{0}: no search string given\n'.format(sys.argv[0])) + sys.exit(1) + query = unicode(' '.join(sys.argv[1:]), 'utf-8') (cache_hit, addresses) = cache_lookup(query) -- 2.26.2