From 845c86f545ddd27e0bade490ff161886c7a587b6 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Thu, 9 Jan 2025 21:14:35 -0600 Subject: [PATCH] misc: chore: cleanup AppletMetadata.CanStart --- src/Ryujinx/Utilities/AppletMetadata.cs | 26 ++++++++++++------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/Ryujinx/Utilities/AppletMetadata.cs b/src/Ryujinx/Utilities/AppletMetadata.cs index 82baed7d3..42c23ee12 100644 --- a/src/Ryujinx/Utilities/AppletMetadata.cs +++ b/src/Ryujinx/Utilities/AppletMetadata.cs @@ -32,29 +32,27 @@ namespace Ryujinx.Ava.Utilities public string GetContentPath(ContentManager contentManager) => (contentManager ?? _contentManager) - .GetInstalledContentPath(ProgramId, StorageId.BuiltInSystem, NcaContentType.Program); + ?.GetInstalledContentPath(ProgramId, StorageId.BuiltInSystem, NcaContentType.Program); public bool CanStart(ContentManager contentManager, out ApplicationData appData, out BlitStruct appControl) { contentManager ??= _contentManager; - if (contentManager == null) - { - appData = null; - appControl = new BlitStruct(0); - return false; - } + if (contentManager == null) + goto BadData; + + string contentPath = GetContentPath(contentManager); + if (string.IsNullOrEmpty(contentPath)) + goto BadData; appData = new() { Name = Name, Id = ProgramId, Path = GetContentPath(contentManager) }; - - if (string.IsNullOrEmpty(appData.Path)) - { - appControl = new BlitStruct(0); - return false; - } - appControl = StructHelpers.CreateCustomNacpData(Name, Version); return true; + + BadData: + appData = null; + appControl = new BlitStruct(0); + return false; } } }