mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 19:50:12 +01:00
fix rare crashes related to None scores
This commit is contained in:
@@ -374,11 +374,11 @@ class YellowBox:
|
|||||||
for diff in self.tja.metadata.course_data:
|
for diff in self.tja.metadata.course_data:
|
||||||
if diff >= Difficulty.URA:
|
if diff >= Difficulty.URA:
|
||||||
continue
|
continue
|
||||||
elif diff in song_box.scores and song_box.scores[diff] is not None and song_box.scores[diff][4] == Crown.DFC:
|
elif diff in song_box.scores and song_box.scores[diff] is not None and song_box.scores[diff][4] is not None and song_box.scores[diff][4] == Crown.DFC:
|
||||||
tex.draw_texture('yellow_box', 's_crown_dfc', x=(diff*60), color=color)
|
tex.draw_texture('yellow_box', 's_crown_dfc', x=(diff*60), color=color)
|
||||||
elif diff in song_box.scores and song_box.scores[diff] is not None and song_box.scores[diff][4] == Crown.FC:
|
elif diff in song_box.scores and song_box.scores[diff] is not None and song_box.scores[diff][4] is not None and song_box.scores[diff][4] == Crown.FC:
|
||||||
tex.draw_texture('yellow_box', 's_crown_fc', x=(diff*60), color=color)
|
tex.draw_texture('yellow_box', 's_crown_fc', x=(diff*60), color=color)
|
||||||
elif diff in song_box.scores and song_box.scores[diff] is not None and song_box.scores[diff][4] >= Crown.CLEAR:
|
elif diff in song_box.scores and song_box.scores[diff] is not None and song_box.scores[diff][4] is not None and song_box.scores[diff][4] >= Crown.CLEAR:
|
||||||
tex.draw_texture('yellow_box', 's_crown_clear', x=(diff*60), color=color)
|
tex.draw_texture('yellow_box', 's_crown_clear', x=(diff*60), color=color)
|
||||||
tex.draw_texture('yellow_box', 's_crown_outline', x=(diff*60), fade=min(fade, 0.25))
|
tex.draw_texture('yellow_box', 's_crown_outline', x=(diff*60), fade=min(fade, 0.25))
|
||||||
|
|
||||||
@@ -418,11 +418,11 @@ class YellowBox:
|
|||||||
continue
|
continue
|
||||||
if diff >= Difficulty.URA:
|
if diff >= Difficulty.URA:
|
||||||
continue
|
continue
|
||||||
elif diff in song_box.scores and song_box.scores[diff] is not None and ((song_box.scores[diff][4] == 2 and song_box.scores[diff][2] == 0) or (song_box.scores[diff][2] == 0 and song_box.scores[diff][3] == 0)):
|
elif diff in song_box.scores and song_box.scores[diff] is not None and ((song_box.scores[diff][4] is not None and song_box.scores[diff][4] == 2 and song_box.scores[diff][2] == 0) or (song_box.scores[diff][2] == 0 and song_box.scores[diff][3] == 0)):
|
||||||
tex.draw_texture('yellow_box', 's_crown_dfc', x=(diff*115)+8, y=-120, fade=self.fade_in.attribute)
|
tex.draw_texture('yellow_box', 's_crown_dfc', x=(diff*115)+8, y=-120, fade=self.fade_in.attribute)
|
||||||
elif diff in song_box.scores and song_box.scores[diff] is not None and ((song_box.scores[diff][4] == 2) or (song_box.scores[diff][3] == 0)):
|
elif diff in song_box.scores and song_box.scores[diff] is not None and ((song_box.scores[diff][4] is not None and song_box.scores[diff][4] == 2) or (song_box.scores[diff][3] == 0)):
|
||||||
tex.draw_texture('yellow_box', 's_crown_fc', x=(diff*115)+8, y=-120, fade=self.fade_in.attribute)
|
tex.draw_texture('yellow_box', 's_crown_fc', x=(diff*115)+8, y=-120, fade=self.fade_in.attribute)
|
||||||
elif diff in song_box.scores and song_box.scores[diff] is not None and song_box.scores[diff][4] >= 1:
|
elif diff in song_box.scores and song_box.scores[diff] is not None and song_box.scores[diff][4] is not None and song_box.scores[diff][4] >= 1:
|
||||||
tex.draw_texture('yellow_box', 's_crown_clear', x=(diff*115)+8, y=-120, fade=self.fade_in.attribute)
|
tex.draw_texture('yellow_box', 's_crown_clear', x=(diff*115)+8, y=-120, fade=self.fade_in.attribute)
|
||||||
tex.draw_texture('yellow_box', 's_crown_outline', x=(diff*115)+8, y=-120, fade=min(self.fade_in.attribute, 0.25))
|
tex.draw_texture('yellow_box', 's_crown_outline', x=(diff*115)+8, y=-120, fade=min(self.fade_in.attribute, 0.25))
|
||||||
|
|
||||||
@@ -746,6 +746,8 @@ class ScoreHistory:
|
|||||||
for j, counter in enumerate(self.scores[self.curr_difficulty]):
|
for j, counter in enumerate(self.scores[self.curr_difficulty]):
|
||||||
if j == Difficulty.TOWER:
|
if j == Difficulty.TOWER:
|
||||||
continue
|
continue
|
||||||
|
if counter is None:
|
||||||
|
continue
|
||||||
counter = str(counter)
|
counter = str(counter)
|
||||||
margin = 24
|
margin = 24
|
||||||
for i in range(len(counter)):
|
for i in range(len(counter)):
|
||||||
@@ -1106,8 +1108,8 @@ class FileNavigator:
|
|||||||
|
|
||||||
scores = song_obj.box.scores.get(course)
|
scores = song_obj.box.scores.get(course)
|
||||||
if scores is not None:
|
if scores is not None:
|
||||||
is_cleared = scores[4] >= Crown.CLEAR
|
is_cleared = scores[4] >= Crown.CLEAR if scores[4] is not None else False
|
||||||
is_full_combo = scores[4] == Crown.FC
|
is_full_combo = scores[4] == Crown.FC if scores[4] is not None else False
|
||||||
else:
|
else:
|
||||||
is_cleared = False
|
is_cleared = False
|
||||||
is_full_combo = False
|
is_full_combo = False
|
||||||
|
|||||||
Reference in New Issue
Block a user