1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-15 11:22:55 +00:00

Fix a bug where songs with no notes would crash the results screen.

This commit is contained in:
EliteMasterEric 2024-06-16 18:34:10 -04:00 committed by Cameron Taylor
parent 81cada675c
commit d44275c2c7

View file

@ -464,7 +464,9 @@ class ResultState extends MusicBeatSubState
{ {
bgFlash.visible = true; bgFlash.visible = true;
FlxTween.tween(bgFlash, {alpha: 0}, 5 / 24); FlxTween.tween(bgFlash, {alpha: 0}, 5 / 24);
var clearPercentFloat = (params.scoreData.tallies.sick + params.scoreData.tallies.good) / params.scoreData.tallies.totalNotes * 100; // NOTE: Only divide if totalNotes > 0 to prevent divide-by-zero errors.
var clearPercentFloat = params.scoreData.tallies.totalNotes == 0 ? 0.0 : (params.scoreData.tallies.sick +
params.scoreData.tallies.good) / params.scoreData.tallies.totalNotes * 100;
clearPercentTarget = Math.floor(clearPercentFloat); clearPercentTarget = Math.floor(clearPercentFloat);
// Prevent off-by-one errors. // Prevent off-by-one errors.