diff options
| author | Mary <me@thog.eu> | 2020-11-27 19:05:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-27 19:05:36 +0100 |
| commit | 245f8a7eeeac59a94535715b6d35e64b7b3b8f9e (patch) | |
| tree | 60e9a4cd2e3d432818536ba72130714c65cf5aa0 | |
| parent | b1877632cfabad9e5856c6f82430ecc851645be9 (diff) | |
ui: Check last played datetime validity against current culture (#1730)
This is an issue happening when you change your datetime format on your
system and try to sort via last played datetime. DateTime.Parse use the
current thread culture and will not parse date correctly, effectively
causing a crash.
As such, I added a check when loading the game list that ensure that the
datetime is valid in current culture.
Fix #1727.
| -rw-r--r-- | Ryujinx/Ui/ApplicationLibrary.cs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Ryujinx/Ui/ApplicationLibrary.cs b/Ryujinx/Ui/ApplicationLibrary.cs index fbf14e0e..353b686e 100644 --- a/Ryujinx/Ui/ApplicationLibrary.cs +++ b/Ryujinx/Ui/ApplicationLibrary.cs @@ -390,6 +390,13 @@ namespace Ryujinx.Ui ApplicationMetadata appMetadata = LoadAndSaveMetaData(titleId); + if (appMetadata.LastPlayed != "Never" && !DateTime.TryParse(appMetadata.LastPlayed, out _)) + { + Logger.Warning?.Print(LogClass.Application, $"Last played datetime \"{appMetadata.LastPlayed}\" is invalid for current system culture, skipping (did current culture change?)"); + + appMetadata.LastPlayed = "Never"; + } + ApplicationData data = new ApplicationData { Favorite = appMetadata.Favorite, |
