Make sure the retry options are positive or 0.

This commit is contained in:
Paul Storkman 2024-12-27 19:43:00 +01:00
parent 0b6b7742c2
commit cac5eedcfc

View File

@ -261,9 +261,11 @@ def validate_options(opts):
elif value in ('inf', 'infinite'):
return float('inf')
try:
return int(value)
ival = int(value)
except (TypeError, ValueError):
validate(False, f'{name} retry count', value)
validate_positive(f'{name} retry count', ival)
return ival
opts.retries = parse_retries('download', opts.retries)
opts.fragment_retries = parse_retries('fragment', opts.fragment_retries)