From 96e2b0fdf06d84183095015803befb049ce3e92c Mon Sep 17 00:00:00 2001 From: Kamila Chyla Date: Wed, 15 Apr 2015 08:50:12 +0200 Subject: [PATCH] Prevent ZeroDivisionError in get_stability method (Fixes #63). Signed-off-by: Adam Waldenberg --- gitinspector/blame.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitinspector/blame.py b/gitinspector/blame.py index a9c0629..f9023dc 100644 --- a/gitinspector/blame.py +++ b/gitinspector/blame.py @@ -172,8 +172,8 @@ class Blame: @staticmethod def get_stability(author, blamed_rows, changes): if author in changes.get_authorinfo_list(): - return 100.0 * blamed_rows / changes.get_authorinfo_list()[author].insertions - + author_insertions = changes.get_authorinfo_list()[author].insertions + return 100 if author_insertions == 0 else 100.0 * blamed_rows / author_insertions return 100 @staticmethod