prevent an error when no search string is given
authorNiels de Vos <devos@fedoraproject.org>
Thu, 13 Dec 2012 09:35:05 +0000 (10:35 +0100)
committerWade Berrier <wberrier@gmail.com>
Sun, 20 Jan 2013 03:36:04 +0000 (20:36 -0700)
mutt-ldap.py

index 05df6f18afd2adf77dbda1e7356e6e4ef75c298c..4117177a6aeb49aaad53cfda255d7e76e1bc4743 100755 (executable)
@@ -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)