Fixed #/bc1e6ff4# (extra argument crash).
authorW. Trevor King <wking@drexel.edu>
Thu, 8 Sep 2011 03:24:18 +0000 (23:24 -0400)
committerW. Trevor King <wking@drexel.edu>
Thu, 8 Sep 2011 03:24:18 +0000 (23:24 -0400)
.be/bea86499-824e-4e77-b085-2d581fa9ccab/bugs/bc1e6ff4-478f-4afe-b2a1-86e25ee448b7/values
libbe/ui/command_line.py

index 71ed832c1dc0417fe7fe4d21d386b1a689e48f17..d06c54c5199e817c0e701ee5a56b5ace43ec616c 100644 (file)
@@ -7,7 +7,7 @@ reporter: Tanguy LE CARROUR <tanguy.lecarrour@gmail.com>
 severity: minor
 
 
-status: open
+status: fixed
 
 
 summary: Crashes when too many arguments are provided
index d5719a6e2c49264cfef71c9721f206db0136532f..f579a193b2ef61b167bf7d94ee6f4b7647dc3922 100644 (file)
@@ -133,8 +133,9 @@ class CmdOptionParser(optparse.OptionParser):
             else:
                 value = self.process_raw_argument(argument=argument, value=arg)
                 parsed_args[i] = value
-        if len(parsed_args) > len(self.command.args) \
-                and self.command.args[-1].repeatable == False:
+        if (len(parsed_args) > len(self.command.args) and
+            (len(self.command.args) == 0 or
+             self.command.args[-1].repeatable == False)):
             raise libbe.command.UserError('Too many arguments')
         for arg in self.command.args[len(parsed_args):]:
             if arg.optional == False: