mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 01:17:35 +09:00
Try-catch around localisation store registration
Some platforms (android, older windows versions) will throw exceptions at runtime when an unsupported `CultureInfo` is attempted to be instantiated, leading to nasty crashes. Add a preventative try-catch registration to prevent the crash, and log the errors for visibility.
This commit is contained in:
parent
89c27dcb10
commit
76db87f9cb
@ -55,6 +55,7 @@ using osu.Game.IO;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Performance;
|
||||
using osu.Game.Skinning.Editor;
|
||||
using osu.Framework.Extensions;
|
||||
|
||||
namespace osu.Game
|
||||
{
|
||||
@ -585,8 +586,16 @@ namespace osu.Game
|
||||
foreach (var language in Enum.GetValues(typeof(Language)).OfType<Language>())
|
||||
{
|
||||
var cultureCode = language.ToCultureCode();
|
||||
|
||||
try
|
||||
{
|
||||
Localisation.AddLanguage(cultureCode, new ResourceManagerLocalisationStore(cultureCode));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(ex, $"Could not load localisations for language \"{cultureCode}\"");
|
||||
}
|
||||
}
|
||||
|
||||
// The next time this is updated is in UpdateAfterChildren, which occurs too late and results
|
||||
// in the cursor being shown for a few frames during the intro.
|
||||
|
Loading…
x
Reference in New Issue
Block a user