Skip to content

Commit

Permalink
Add a check for empty notedata in the osu loader
Browse files Browse the repository at this point in the history
  • Loading branch information
caiohsr14 committed Dec 10, 2018
1 parent 2b8306b commit 8874070
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/NotesLoaderOSU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,17 @@ OsuLoader::SeparateTagsAndContents(string fileContents,
} else if (isContent) {
if ((currentByte == '[' && lastByte == '\n') ||
i == (int)fileContents.length() - 1) {
contentsOut.back().emplace_back(content);
if (!content.empty()) // we don't want empty values on our
// content vectors
contentsOut.back().emplace_back(content);
content = "";
isContent = false;
tag = "";
isTag = true;
} else if (currentByte == '\n') {
contentsOut.back().emplace_back(content);
if (!content.empty()) // we don't want empty values on our
// content vectors
contentsOut.back().emplace_back(content);
content = "";
} else {
content = content + currentByte;
Expand Down Expand Up @@ -198,7 +202,7 @@ OsuLoader::LoadChartData(Song* song,
Steps* chart,
map<string, map<string, string>> parsedData)
{
if (stoi(parsedData["General"]["Mode"]) != 3) // if the mode isn't mania
if (stoi(parsedData["General"]["Mode"]) != 3 || parsedData.find("HitObjects") == parsedData.end()) // if the mode isn't mania or notedata is empty
{
return false;
}
Expand Down

0 comments on commit 8874070

Please sign in to comment.