Merge pull request #2127 from pizzaboxer/bugfix/fix-managecustomfont-crash

Fix ManageCustomFont crash
This commit is contained in:
pizzaboxer 2024-06-22 12:16:01 +01:00 committed by GitHub
commit bf412cdb6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,7 +46,7 @@ namespace Bloxstrap.UI.ViewModels.Menu
string type = dialog.FileName.Substring(dialog.FileName.Length-3, 3).ToLowerInvariant();
if (!File.ReadAllBytes(dialog.FileName).Take(4).SequenceEqual(FontHeaders[type]))
if (!FontHeaders.ContainsKey(type) || !File.ReadAllBytes(dialog.FileName).Take(4).SequenceEqual(FontHeaders[type]))
{
Frontend.ShowMessageBox(Resources.Strings.Menu_Mods_Misc_CustomFont_Invalid, MessageBoxImage.Error);
return;