Skip to content

Commit

Permalink
Properly set replay type in FillInHighscore
Browse files Browse the repository at this point in the history
prevents a crash when assuming all incoming highscores are built from .60+ replay data which is not always true given older replays exist (assuming replay type 2 and then dying when accessing the empty arrays out of bounds in wife3 recalc)
  • Loading branch information
poco0317 committed Mar 21, 2021
1 parent 9b58864 commit 1ba0f4d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Etterna/Models/Misc/StageStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,15 @@ FillInHighScore(const PlayerStageStats& pss,
hs.SetTrackVector(pss.GetTrackVector());
hs.SetTapNoteTypeVector(pss.GetTapNoteTypeVector());
hs.SetHoldReplayDataVector(pss.GetHoldReplayDataVector());
hs.SetReplayType(
2); // flag this before rescore so it knows we're LEGGIT
// flag this before rescore so it knows we're LEGGIT
hs.SetReplayType(2);
if (hs.GetTapNoteTypeVector().size() < hs.GetNoteRowVector().size() ||
hs.GetTrackVector().size() < hs.GetNoteRowVector().size()) {
// what happened here is most likely that the replay type is not 2
// (missing column data, missing type data)
// it's a replay made before 0.60
hs.SetReplayType(1);
}

// ok this is a little jank but there's a few things going on here,
// first we can't trust that scores getting here are necessarily either
Expand Down

0 comments on commit 1ba0f4d

Please sign in to comment.