From 887407008e24adc85038766a21da5f2dc28841a3 Mon Sep 17 00:00:00 2001 From: Caio Rodrigues Date: Mon, 10 Dec 2018 20:48:40 -0300 Subject: [PATCH] Add a check for empty notedata in the osu loader --- src/NotesLoaderOSU.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/NotesLoaderOSU.cpp b/src/NotesLoaderOSU.cpp index 23f8254249..bb92359afc 100644 --- a/src/NotesLoaderOSU.cpp +++ b/src/NotesLoaderOSU.cpp @@ -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; @@ -198,7 +202,7 @@ OsuLoader::LoadChartData(Song* song, Steps* chart, map> 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; }