From b41bdfaee39808c8fc29b6815065b7d475300265 Mon Sep 17 00:00:00 2001 From: goat <16760685+goaaats@users.noreply.github.com> Date: Fri, 7 Aug 2020 11:23:24 +0200 Subject: [PATCH] fix: restructure init task, needs some rewrites some time --- Dalamud/Dalamud.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs index 36cd31cb8..d70164380 100644 --- a/Dalamud/Dalamud.cs +++ b/Dalamud/Dalamud.cs @@ -89,8 +89,14 @@ namespace Dalamud { this.WinSock2 = new WinSockHandlers(); - AssetManager.EnsureAssets(this.baseDirectory).ContinueWith(async task => { - if (task.IsCanceled || task.IsFaulted) throw new Exception("Could not ensure assets.", task.Exception); + Task.Run(async () => { + try { + await AssetManager.EnsureAssets(this.baseDirectory); + } catch (Exception e) { + Log.Error(e, "Could not ensure assets."); + Unload(); + return; + } this.LocalizationManager = new Localization(this.StartInfo.WorkingDirectory); if (!string.IsNullOrEmpty(this.Configuration.LanguageOverride)) @@ -119,7 +125,13 @@ namespace Dalamud { } Data = new DataManager(this.StartInfo.Language); - await Data.Initialize(this.baseDirectory); + try { + await Data.Initialize(this.baseDirectory); + } catch (Exception e) { + Log.Error(e, "Could not initialize DataManager."); + Unload(); + return; + } SeStringManager = new SeStringManager(Data);