From 1a661bc08baa2572ca6b3da711ce2597ec4229b4 Mon Sep 17 00:00:00 2001 From: trawzified Date: Wed, 25 Sep 2019 18:30:09 +0200 Subject: [PATCH 1/2] Fix crash at selecting non-profile directory --- Wabbajack/AppState.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Wabbajack/AppState.cs b/Wabbajack/AppState.cs index 177a5c22..b6f70051 100644 --- a/Wabbajack/AppState.cs +++ b/Wabbajack/AppState.cs @@ -305,13 +305,15 @@ namespace Wabbajack if (folder != null) { var file = Path.Combine(folder, "modlist.txt"); - if (!File.Exists(file)) + if(File.Exists(file)) + { + Location = file; + ConfigureForBuild(); + } + else { Utils.Log($"No modlist.txt found at {file}"); } - - Location = file; - ConfigureForBuild(); } } } From 25685cc4b65a5dc020f38ed96da4f3320c933540 Mon Sep 17 00:00:00 2001 From: trawzified Date: Wed, 25 Sep 2019 18:57:59 +0200 Subject: [PATCH 2/2] Add validation to prevent crash when starting compilation without selected profile folder --- Wabbajack/AppState.cs | 56 ++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/Wabbajack/AppState.cs b/Wabbajack/AppState.cs index b6f70051..83f02c3b 100644 --- a/Wabbajack/AppState.cs +++ b/Wabbajack/AppState.cs @@ -381,32 +381,40 @@ namespace Wabbajack } else { - var compiler = new Compiler(_mo2Folder, msg => LogMsg(msg)); - compiler.IgnoreMissingFiles = IgnoreMissingFiles; - compiler.MO2Profile = ModListName; - var th = new Thread(() => + if (_mo2Folder != null) { - UIReady = false; - try + var compiler = new Compiler(_mo2Folder, msg => LogMsg(msg)); + compiler.IgnoreMissingFiles = IgnoreMissingFiles; + compiler.MO2Profile = ModListName; + var th = new Thread(() => { - compiler.Compile(); - if (compiler.ModList != null && compiler.ModList.ReportHTML != null) - HTMLReport = compiler.ModList.ReportHTML; - } - catch (Exception ex) - { - while (ex.InnerException != null) ex = ex.InnerException; - LogMsg(ex.StackTrace); - LogMsg(ex.ToString()); - LogMsg($"{ex.Message} - Can't continue"); - } - finally - { - UIReady = true; - } - }); - th.Priority = ThreadPriority.BelowNormal; - th.Start(); + UIReady = false; + try + { + compiler.Compile(); + if (compiler.ModList != null && compiler.ModList.ReportHTML != null) + HTMLReport = compiler.ModList.ReportHTML; + } + catch (Exception ex) + { + while (ex.InnerException != null) ex = ex.InnerException; + LogMsg(ex.StackTrace); + LogMsg(ex.ToString()); + LogMsg($"{ex.Message} - Can't continue"); + } + finally + { + UIReady = true; + } + }); + th.Priority = ThreadPriority.BelowNormal; + th.Start(); + } + else + { + Utils.Log("Cannot compile modlist: no valid Mod Organizer profile directory selected."); + UIReady = true; + } } }