forked from josch/img2pdf
do not allow negative values in parse_num()
This commit is contained in:
parent
a2d846052e
commit
5b7f93bb9a
1 changed files with 3 additions and 0 deletions
|
@ -2083,6 +2083,9 @@ def parse_num(num, name):
|
|||
except ValueError:
|
||||
msg = "%s is not a floating point number: %s" % (name, num)
|
||||
raise argparse.ArgumentTypeError(msg)
|
||||
if num < 0:
|
||||
msg = "%s must not be negative: %s" % (name, num)
|
||||
raise argparse.ArgumentTypeError(msg)
|
||||
if unit == Unit.cm:
|
||||
num = cm_to_pt(num)
|
||||
elif unit == Unit.mm:
|
||||
|
|
Loading…
Reference in a new issue