Skip to content

Commit

Permalink
pre-empt null steps crash when uploading replays
Browse files Browse the repository at this point in the history
this can only occur if ischartloaded() which counts [key] in songsbykey is true, but getstepsbykey which grabs [key] in stepsbykey returns a nullptr, which shoiuldn't be possible since songsbykey only has entries added after stepbykey has an entry added for the same key

in other words this shouldn't be possible, yet it consistently is crashing for me on hi19s eternus chart
  • Loading branch information
MinaciousGrace committed Nov 30, 2018
1 parent 8bd3e8f commit 4052c14
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/DownloadManager.cpp
Expand Up @@ -873,6 +873,8 @@ SetCURLPOSTScore(CURL*& curlHandle,
curlHandle, form, lastPtr, "chartkey", hs->GetChartKey());
SetCURLFormPostField(curlHandle, form, lastPtr, "rate", hs->musics);
auto chart = SONGMAN->GetStepsByChartkey(hs->GetChartKey());
if (chart == nullptr)
return;
SetCURLFormPostField(curlHandle,
form,
lastPtr,
Expand Down Expand Up @@ -1062,6 +1064,8 @@ DownloadManager::UploadScoreWithReplayDataFromDisk(string sk,
if (offsets.size() > 0) {
replayString = "[";
auto steps = SONGMAN->GetStepsByChartkey(hs->GetChartKey());
if (steps == nullptr)
return;
vector<float> timestamps =
steps->GetTimingData()->ConvertReplayNoteRowsToTimestamps(
hs->GetNoteRowVector(), hs->GetMusicRate());
Expand Down

0 comments on commit 4052c14

Please sign in to comment.