diff --git a/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_attachments.cpp b/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_attachments.cpp index 1244be2ec..66060f3b5 100644 --- a/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_attachments.cpp +++ b/libraries/libstratosphere/source/erpt/srv/erpt_srv_journal_for_attachments.cpp @@ -118,12 +118,17 @@ namespace ams::erpt::srv { auto record_guard = SCOPE_GUARD { delete record; }; - R_UNLESS(R_SUCCEEDED(Stream::GetStreamSize(std::addressof(record->info.attachment_size), Attachment::FileName(record->info.attachment_id).name)), erpt::ResultCorruptJournal()); + if (R_FAILED(Stream::GetStreamSize(std::addressof(record->info.attachment_size), Attachment::FileName(record->info.attachment_id).name))) { + continue; + } if (record->info.flags.Test() && JournalForReports::RetrieveRecord(record->info.owner_report_id) != nullptr) { /* NOTE: Nintendo does not check the result of storing the new record... */ record_guard.Cancel(); StoreRecord(record); + } else { + /* If the attachment has no owner (or we deleted the report), delete the file associated with it. */ + Stream::DeleteStream(Attachment::FileName(record->info.attachment_id).name); } }