From f1b02e1a041e76201a8469177cddb68ddf67262e Mon Sep 17 00:00:00 2001 From: emmaus Date: Thu, 9 Aug 2018 08:02:27 +0000 Subject: [PATCH] dont crash when fonts are not found --- Ryujinx.HLE/Font/SharedFontManager.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Ryujinx.HLE/Font/SharedFontManager.cs b/Ryujinx.HLE/Font/SharedFontManager.cs index fce270de86..2a0ae8c109 100644 --- a/Ryujinx.HLE/Font/SharedFontManager.cs +++ b/Ryujinx.HLE/Font/SharedFontManager.cs @@ -46,6 +46,7 @@ namespace Ryujinx.HLE.Font }; int FontMemoryUsage = 0; + foreach (byte[] data in FontData.Values) { FontMemoryUsage += data.Length; @@ -63,13 +64,16 @@ namespace Ryujinx.HLE.Font public byte[] GetData(string FontName) { string FontFilePath = Path.Combine(FontsPath, $"{FontName}.ttf"); + if (File.Exists(FontFilePath)) { return File.ReadAllBytes(FontFilePath); } else { - throw new InvalidSystemResourceException($"Font \"{FontName}.ttf\" not found. Please provide it in \"{FontsPath}\"."); + Console.WriteLine($"Font \"{FontName}.ttf\" not found. Please provide it in \"{FontsPath}\"."); + + return new byte[0]; } }