system-info: fix possible float division by zero in calculating % value
This commit is contained in:
parent
70a6bbf0ff
commit
a218d75e0a
1 changed files with 4 additions and 1 deletions
|
|
@ -892,7 +892,10 @@ class ScmModel(BaseModel):
|
|||
from rhodecode.model.gist import GIST_STORE_LOC
|
||||
|
||||
def percentage(part, whole):
|
||||
return 100 * float(part) / float(whole)
|
||||
whole = float(whole)
|
||||
if whole > 0:
|
||||
return 100 * float(part) / whole
|
||||
return 0
|
||||
|
||||
try:
|
||||
# cygwin cannot have yet psutil support.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue