Skip to content

Commit 1ba0f4d

Browse files
committed
Properly set replay type in FillInHighscore
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)
1 parent 9b58864 commit 1ba0f4d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Etterna/Models/Misc/StageStats.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,15 @@ FillInHighScore(const PlayerStageStats& pss,
619619
hs.SetTrackVector(pss.GetTrackVector());
620620
hs.SetTapNoteTypeVector(pss.GetTapNoteTypeVector());
621621
hs.SetHoldReplayDataVector(pss.GetHoldReplayDataVector());
622-
hs.SetReplayType(
623-
2); // flag this before rescore so it knows we're LEGGIT
622+
// flag this before rescore so it knows we're LEGGIT
623+
hs.SetReplayType(2);
624+
if (hs.GetTapNoteTypeVector().size() < hs.GetNoteRowVector().size() ||
625+
hs.GetTrackVector().size() < hs.GetNoteRowVector().size()) {
626+
// what happened here is most likely that the replay type is not 2
627+
// (missing column data, missing type data)
628+
// it's a replay made before 0.60
629+
hs.SetReplayType(1);
630+
}
624631

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

0 commit comments

Comments
 (0)