From: Niels de Vos Date: Thu, 13 Dec 2012 09:35:05 +0000 (+0100) Subject: prevent an error when no search string is given X-Git-Tag: v0.1~27^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=874f0eaad10d384f92108488a34626f86f03c8c0;p=mutt-ldap.git prevent an error when no search string is given --- 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)