From 041937b2d87e6d85464c55de3c2bb5bcb419e7fb Mon Sep 17 00:00:00 2001 From: Sayu <104025906+SayuShira@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:49:33 +0200 Subject: [PATCH] fix: changelog crashes on improper LastUpdate timestamp (#1493) --- .../PluginInstaller/PluginChangelogEntry.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginChangelogEntry.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginChangelogEntry.cs index b4048536e..879034fd4 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginChangelogEntry.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginChangelogEntry.cs @@ -1,7 +1,6 @@ -using System; - -using CheapLoc; +using CheapLoc; using Dalamud.Plugin.Internal.Types; +using Serilog; namespace Dalamud.Interface.Internal.Windows.PluginInstaller; @@ -36,7 +35,18 @@ internal class PluginChangelogEntry : IChangelogEntry this.Version = plugin.EffectiveVersion.ToString(); this.Text = plugin.Manifest.Changelog ?? Loc.Localize("ChangelogNoText", "No changelog for this version."); this.Author = plugin.Manifest.Author; - this.Date = DateTimeOffset.FromUnixTimeSeconds(this.Plugin.Manifest.LastUpdate).DateTime; + + try + { + this.Date = DateTimeOffset.FromUnixTimeSeconds(this.Plugin.Manifest.LastUpdate).DateTime; + } + catch (ArgumentOutOfRangeException ex) + { + Log.Warning(ex, "Manifest included improper timestamp, e.g. wrong unit: {PluginName}", + plugin.Manifest.Name); + // Create a Date from 0 as with a manifest that does not include a LastUpdate field + this.Date = DateTimeOffset.FromUnixTimeSeconds(0).DateTime; + } } ///