Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
sbws
Commits
109d2b41
Commit
109d2b41
authored
Apr 08, 2018
by
juga
Browse files
Fix ZeroDivision by ensuring there're v3bw lines and total bw is > 0
parent
69de7db5
Changes
1
Hide whitespace changes
Inline
Side-by-side
sbws/commands/generate.py
View file @
109d2b41
...
...
@@ -51,7 +51,10 @@ def warn_if_not_accurate_enough(lines, constant):
def
scale_lines
(
args
,
v3bw_lines
):
assert
len
(
v3bw_lines
>
0
)
total
=
sum
([
l
.
bw
for
l
in
v3bw_lines
])
# In case total is zero, it will run on ZeroDivision
assert
total
>
0
if
args
.
scale
:
scale
=
len
(
v3bw_lines
)
*
args
.
scale_constant
else
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment