From fbc766520ad7c845ccc11ebb524e875c0e1f94e7 Mon Sep 17 00:00:00 2001 From: LWR Date: Sat, 9 Nov 2024 00:07:29 +0800 Subject: [PATCH] fix: Fixed possible ZeroDivisionError when generate double ranking diagram --- starbot/painter/RankingGenerator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starbot/painter/RankingGenerator.py b/starbot/painter/RankingGenerator.py index d768a13..30ee138 100644 --- a/starbot/painter/RankingGenerator.py +++ b/starbot/painter/RankingGenerator.py @@ -158,7 +158,7 @@ class RankingGenerator: chart = PicGenerator(width, (face_size * count) + (row_space * (count - 1))) chart.set_row_space(row_space) for i in range(count): - bar_width = int(abs(counts[i]) / top_count * top_bar_width) + bar_width = int(abs(counts[i]) / top_count * top_bar_width) if top_count != 0 else 0.1 if bar_width != 0: if counts[i] > 0: bar = cls.__get_rank_bar_pic(bar_width, bar_height, start_color, end_color)