aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2024-07-18 00:02:20 +0200
committerGitHub <noreply@github.com>2024-07-17 19:02:20 -0300
commitf77bebac80bd2fcbee72b00845e56faf3de3bad6 (patch)
treed7319b8d56391039c9068c39026bc465a57029c9 /src
parent6fbf279faca30ffd2ef33394463b98809ccaf127 (diff)
Include content data foreach-loop in try-catch (#7036)1.1.1351
Diffstat (limited to 'src')
-rw-r--r--src/Ryujinx.UI.Common/App/ApplicationLibrary.cs49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs
index ef3826cf..2baf0608 100644
--- a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs
+++ b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs
@@ -175,22 +175,22 @@ namespace Ryujinx.UI.App.Common
var applications = new List<ApplicationData>();
string extension = Path.GetExtension(filePath).ToLower();
- foreach ((ulong titleId, ContentMetaData content) in pfs.GetContentData(ContentMetaType.Application, _virtualFileSystem, _checkLevel))
+ try
{
- ApplicationData applicationData = new()
+ foreach ((ulong titleId, ContentMetaData content) in pfs.GetContentData(ContentMetaType.Application, _virtualFileSystem, _checkLevel))
{
- Id = titleId,
- Path = filePath,
- };
+ ApplicationData applicationData = new()
+ {
+ Id = titleId,
+ Path = filePath,
+ };
- try
- {
Nca mainNca = content.GetNcaByType(_virtualFileSystem.KeySet, ContentType.Program);
Nca controlNca = content.GetNcaByType(_virtualFileSystem.KeySet, ContentType.Control);
BlitStruct<ApplicationControlProperty> controlHolder = new(1);
- IFileSystem controlFs = controlNca?.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None);
+ IFileSystem controlFs = controlNca?.OpenFileSystem(NcaSectionType.Data, _checkLevel);
// Check if there is an update available.
if (IsUpdateApplied(mainNca, out IFileSystem updatedControlFs))
@@ -199,6 +199,11 @@ namespace Ryujinx.UI.App.Common
controlFs = updatedControlFs;
}
+ if (controlFs == null)
+ {
+ continue;
+ }
+
ReadControlData(controlFs, controlHolder.ByteSpan);
GetApplicationInformation(ref controlHolder.Value, ref applicationData);
@@ -246,22 +251,18 @@ namespace Ryujinx.UI.App.Common
applications.Add(applicationData);
}
- catch (MissingKeyException exception)
- {
- applicationData.Icon = extension == ".xci" ? _xciIcon : _nspIcon;
-
- Logger.Warning?.Print(LogClass.Application, $"Your key set is missing a key with the name: {exception.Name}");
- }
- catch (InvalidDataException)
- {
- applicationData.Icon = extension == ".xci" ? _xciIcon : _nspIcon;
-
- Logger.Warning?.Print(LogClass.Application, $"The header key is incorrect or missing and therefore the NCA header content type check has failed. Errored File: {filePath}");
- }
- catch (Exception exception)
- {
- Logger.Warning?.Print(LogClass.Application, $"The file encountered was not of a valid type. File: '{filePath}' Error: {exception}");
- }
+ }
+ catch (MissingKeyException exception)
+ {
+ Logger.Warning?.Print(LogClass.Application, $"Your key set is missing a key with the name: {exception.Name}");
+ }
+ catch (InvalidDataException)
+ {
+ Logger.Warning?.Print(LogClass.Application, $"The header key is incorrect or missing and therefore the NCA header content type check has failed. Errored File: {filePath}");
+ }
+ catch (Exception exception)
+ {
+ Logger.Warning?.Print(LogClass.Application, $"The file encountered was not of a valid type. File: '{filePath}' Error: {exception}");
}
return applications;