From b8f48bcf640acae519602a26fd6c4ce49c04709b Mon Sep 17 00:00:00 2001 From: Ac_K Date: Thu, 1 Jun 2023 18:24:00 +0200 Subject: UI: Fix empty homebrew icon (#5189) * UI: Fix empty homebrew icon We currently don't check the icon size when we read it from the homebrew data. That could cause issues at UI side since the buffer isn't null but empty. Extra check have been added UI side too. (I cleaned up some files during my research too) Fixes #5188 * Remove additional check * Remove unused using --- src/Ryujinx.Ui.Common/App/ApplicationLibrary.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/Ryujinx.Ui.Common/App/ApplicationLibrary.cs') diff --git a/src/Ryujinx.Ui.Common/App/ApplicationLibrary.cs b/src/Ryujinx.Ui.Common/App/ApplicationLibrary.cs index 0407036a..f52af611 100644 --- a/src/Ryujinx.Ui.Common/App/ApplicationLibrary.cs +++ b/src/Ryujinx.Ui.Common/App/ApplicationLibrary.cs @@ -343,7 +343,14 @@ namespace Ryujinx.Ui.App.Common ulong nacpSize = reader.ReadUInt64(); // Reads and stores game icon as byte array - applicationIcon = Read(assetOffset + iconOffset, (int)iconSize); + if (iconSize > 0) + { + applicationIcon = Read(assetOffset + iconOffset, (int)iconSize); + } + else + { + applicationIcon = _nroIcon; + } // Read the NACP data Read(assetOffset + (int)nacpOffset, (int)nacpSize).AsSpan().CopyTo(controlHolder.ByteSpan); @@ -666,7 +673,14 @@ namespace Ryujinx.Ui.App.Common long iconSize = BitConverter.ToInt64(iconSectionInfo, 8); // Reads and stores game icon as byte array - applicationIcon = Read(assetOffset + iconOffset, (int)iconSize); + if (iconSize > 0) + { + applicationIcon = Read(assetOffset + iconOffset, (int)iconSize); + } + else + { + applicationIcon = _nroIcon; + } } else { -- cgit v1.2.3