Skip to content

Commit

Permalink
Merge pull request #59 from w3irDv/fix/duptitle
Browse files Browse the repository at this point in the history
fix crash during wiiu titles scanning due to duplicate savedata in nand and usb
  • Loading branch information
w3irDv authored Aug 22, 2024
2 parents 46af3bf + a887ea9 commit 2ee1332
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ static Title *loadWiiUTitles(int run) {
path = StringUtils::stringFormat("%s/usr/save/%08x/%s/meta/meta.xml", (i == 0) ? getUSB().c_str() : "storage_mlc01:", highIDs[a],
data->d_name);
if (checkEntry(path.c_str()) == 1) {
for (int i = 0; i < usable; i++) {
if (contains(highIDs, savesl[i].highID) &&
(strtoul(data->d_name, nullptr, 16) == savesl[i].lowID)) {
savesl[i].found = true;
for (int ii = 0; ii < usable; ii++) {
if (contains(highIDs, savesl[ii].highID) &&
(strtoul(data->d_name, nullptr, 16) == savesl[ii].lowID) &&
savesl[ii].dev == i ) {
savesl[ii].found = true;
tNoSave--;
break;
}
Expand All @@ -109,7 +110,7 @@ static Title *loadWiiUTitles(int run) {
}

foundCount += tNoSave;
auto *saves = (Saves *) malloc((foundCount + tNoSave) * sizeof(Saves));
auto *saves = (Saves *) malloc((foundCount) * sizeof(Saves));
if (saves == nullptr) {
promptError(LanguageUtils::gettext("Out of memory."));
return nullptr;
Expand Down

0 comments on commit 2ee1332

Please sign in to comment.