From 9644dd9922b608a2b180df700158924f6e086431 Mon Sep 17 00:00:00 2001 From: Soreepeong Date: Mon, 26 Feb 2024 03:31:15 +0900 Subject: [PATCH] Ensure that TextureWrapTaskIconSource.Materialize do not throw --- .../IconSource/TextureWrapTaskIconSource.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Dalamud/Interface/ImGuiNotification/IconSource/TextureWrapTaskIconSource.cs b/Dalamud/Interface/ImGuiNotification/IconSource/TextureWrapTaskIconSource.cs index 28fdc4d96..2a5473760 100644 --- a/Dalamud/Interface/ImGuiNotification/IconSource/TextureWrapTaskIconSource.cs +++ b/Dalamud/Interface/ImGuiNotification/IconSource/TextureWrapTaskIconSource.cs @@ -6,6 +6,8 @@ using Dalamud.Interface.Internal; using Dalamud.Plugin.Internal.Types; using Dalamud.Utility; +using Serilog; + namespace Dalamud.Interface.ImGuiNotification.IconSource; /// Represents the use of future as the icon of a notification. @@ -41,7 +43,18 @@ public readonly struct TextureWrapTaskIconSource : INotificationIconSource.IInte { private Task? task; - public MaterializedIcon(Func?>? taskFunc) => this.task = taskFunc?.Invoke(); + public MaterializedIcon(Func?>? taskFunc) + { + try + { + this.task = taskFunc?.Invoke(); + } + catch (Exception e) + { + Log.Error(e, $"{nameof(TextureWrapTaskIconSource)}: failed to materialize the icon texture."); + this.task = null; + } + } public void Dispose() {