Skip to content

Commit

Permalink
dont crash when playing a file with 0 notes
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Sep 23, 2024
1 parent 0a6ed96 commit cd27b64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/Etterna/Models/HighScore/HighScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,14 @@ HighScore::RescoreToWife3(float pmax) -> bool
return false;
}

if (pmax <= 0.F) {
m_Impl->fSSRNormPercent = 0.F;
m_Impl->fWifeScore = 0.F;
m_Impl->fWifePoints = 0.F;
m_Impl->WifeVersion = 3;
return true;
}

// SSRNormPercent
auto p4 = 0.F;
// WifeScore for HighScore Judge
Expand Down
5 changes: 1 addition & 4 deletions src/Etterna/Models/Misc/StageStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,8 @@ FillInHighScore(const PlayerStageStats& pss,
NoteDataUtil::TransformNoteData(nd, *td, po, style->m_StepsType);
GAMESTATE->m_iStageSeed = tmpSeed;
}
auto maxpoints = static_cast<float>(nd.WifeTotalScoreCalc(td));

// explode the game if something broke
ASSERT(maxpoints > 0);

auto maxpoints = static_cast<float>(nd.WifeTotalScoreCalc(td));
if (pss.GetGrade() == Grade_Failed) {
hs.SetSSRNormPercent(0.F);
} else {
Expand Down

0 comments on commit cd27b64

Please sign in to comment.