[elbe-devel] [PATCH 09/13] commands/validate: check number of arguments

Manuel Traut manut at linutronix.de
Thu Nov 30 15:15:11 CET 2017


to avoid outofindex exception if no filename is given

Signed-off-by: Manuel Traut <manut at linutronix.de>
---
 elbepack/commands/validate.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/elbepack/commands/validate.py b/elbepack/commands/validate.py
index f9ff4e86..99a6368b 100644
--- a/elbepack/commands/validate.py
+++ b/elbepack/commands/validate.py
@@ -30,6 +30,10 @@ def run_command( argv ):
 
     (opt,args) = oparser.parse_args(sys.argv)
 
+    if len(args) < 3:
+        oparser.print_help()
+        sys.exit(20)
+
     if not os.path.exists(args[2]):
         print ("%s - file not found" % args[2])
         oparser.print_help()
-- 
2.15.1




More information about the elbe-devel mailing list