Skip to content

Commit 6247bf7

Browse files
committed
fix: divided by zero
1 parent 5f1d614 commit 6247bf7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/components/battery_history_card.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def updateBatteryHistory(self, battery_history_dic):
8787
stride = 15
8888
previous_timestamp = 0
8989
i = 0
90-
linewidth = min(5, self.width() / (len(x_list)) * 3)
90+
linewidth = min(5, self.width() / (len(x_list)) * 3 if len(x_list) != 0 else 1)
9191
for x, y, charging in zip(x_list, battery_history_dic["battery"], battery_history_dic["charging"]):
9292
# vertical lines with color indicating charging status
9393
# if consecutive records less than `stride`, then ignore

0 commit comments

Comments
 (0)