mirror of
https://github.com/switchbrew/switch-examples.git
synced 2025-06-21 05:12:40 +02:00
Fixed issue with the fs/save example where the FsSaveDataInfoReader was not closed when a save was found successfully.
This commit is contained in:
parent
948ce48e58
commit
a34aba3b72
@ -11,6 +11,7 @@ Result get_save(u64 *application_id, AccountUid *uid) {
|
|||||||
FsSaveDataInfoReader reader;
|
FsSaveDataInfoReader reader;
|
||||||
s64 total_entries=0;
|
s64 total_entries=0;
|
||||||
FsSaveDataInfo info;
|
FsSaveDataInfo info;
|
||||||
|
bool found=0;
|
||||||
|
|
||||||
rc = fsOpenSaveDataInfoReader(&reader, FsSaveDataSpaceId_User);//See libnx fs.h.
|
rc = fsOpenSaveDataInfoReader(&reader, FsSaveDataSpaceId_User);//See libnx fs.h.
|
||||||
if (R_FAILED(rc)) {
|
if (R_FAILED(rc)) {
|
||||||
@ -26,13 +27,14 @@ Result get_save(u64 *application_id, AccountUid *uid) {
|
|||||||
if (info.save_data_type == FsSaveDataType_Account) {//Filter by FsSaveDataType_Account, however note that FsSaveDataSpaceId_User can have non-FsSaveDataType_Account.
|
if (info.save_data_type == FsSaveDataType_Account) {//Filter by FsSaveDataType_Account, however note that FsSaveDataSpaceId_User can have non-FsSaveDataType_Account.
|
||||||
*application_id = info.application_id;
|
*application_id = info.application_id;
|
||||||
*uid = info.uid;
|
*uid = info.uid;
|
||||||
return 0;
|
found = 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fsSaveDataInfoReaderClose(&reader);
|
fsSaveDataInfoReaderClose(&reader);
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) return MAKERESULT(Module_Libnx, LibnxError_NotFound);
|
if (R_SUCCEEDED(rc) && !found) return MAKERESULT(Module_Libnx, LibnxError_NotFound);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user