mirror of
https://github.com/switchbrew/switch-examples.git
synced 2025-06-20 21:12:38 +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;
|
||||
s64 total_entries=0;
|
||||
FsSaveDataInfo info;
|
||||
bool found=0;
|
||||
|
||||
rc = fsOpenSaveDataInfoReader(&reader, FsSaveDataSpaceId_User);//See libnx fs.h.
|
||||
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.
|
||||
*application_id = info.application_id;
|
||||
*uid = info.uid;
|
||||
return 0;
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user