donate-cpu.py: Fix possible usage of none type variable

"bandwidth_limit" is None by default and therefore can not be used for string
concatenation in this case.
This commit is contained in:
versat 2019-01-19 12:45:08 +01:00
parent e3db99a16e
commit dfaba30290
1 changed files with 6 additions and 5 deletions

View File

@ -374,6 +374,7 @@ for arg in sys.argv[1:]:
print('Thank you!') print('Thank you!')
if not checkRequirements(): if not checkRequirements():
sys.exit(1) sys.exit(1)
if bandwidth_limit and isinstance(bandwidth_limit, str):
if subprocess.call(['wget', '--limit-rate=' + bandwidth_limit, '-q', '--spider', 'cppcheck.osuosl.org']) is 2: if subprocess.call(['wget', '--limit-rate=' + bandwidth_limit, '-q', '--spider', 'cppcheck.osuosl.org']) is 2:
print('Error: Bandwidth limit value "' + bandwidth_limit + '" is invalid.') print('Error: Bandwidth limit value "' + bandwidth_limit + '" is invalid.')
sys.exit(1) sys.exit(1)