Skip to content

Commit

Permalink
fixed division by zero
Browse files Browse the repository at this point in the history
when show_text_tm is 0, line 523 could crash the program
  • Loading branch information
ChristianBuer authored and helgeerbe committed Feb 19, 2024
1 parent 81de115 commit 2ed1295
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/picframe/viewer_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,10 @@ def slideshow_is_running(self, pics=None, time_delay=200.0, fade_time=10.0, paus

if self.__alpha >= 1.0 and tm < self.__name_tm:
# this sets alpha for the TextBlock from 0 to 1 then back to 0
dt = 1.0 - (self.__name_tm - tm) / self.__show_text_tm
if self.__show_text_tm > 0:
dt = 1.0 - (self.__name_tm - tm) / self.__show_text_tm
else
dt = 1
if dt > 0.995:
dt = 1 # ensure that calculated alpha value fully reaches 0 (TODO: Improve!)
ramp_pt = max(4.0, self.__show_text_tm / 4.0) # always > 4 so text fade will always < 4s
Expand Down

0 comments on commit 2ed1295

Please sign in to comment.