Skip to content

Commit

Permalink
fix crash when scanning titles due to duplicate data nand/usb
Browse files Browse the repository at this point in the history
  • Loading branch information
w3irDv committed Jul 29, 2024
1 parent 103c505 commit 8eb1ec3
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 8eb1ec3

Please sign in to comment.