diff --git a/src/HexManiac.Core/Models/Singletons.cs b/src/HexManiac.Core/Models/Singletons.cs index b8749c77..36df5440 100644 --- a/src/HexManiac.Core/Models/Singletons.cs +++ b/src/HexManiac.Core/Models/Singletons.cs @@ -71,6 +71,7 @@ namespace HavenSoft.HexManiac.Core.Models { BattleScriptLines = new ScriptLine[0]; AnimationScriptLines = new ScriptLine[0]; BattleAIScriptLines = new ScriptLine[0]; + DocReference = new Dictionary>(); WorkDispatcher = InstantDispatch.Instance; CopyLimit = copyLimit; PythonUtility = string.Empty; diff --git a/src/HexManiac.Core/ViewModels/ViewPort.cs b/src/HexManiac.Core/ViewModels/ViewPort.cs index 575091a1..52b8b7c5 100644 --- a/src/HexManiac.Core/ViewModels/ViewPort.cs +++ b/src/HexManiac.Core/ViewModels/ViewPort.cs @@ -1025,7 +1025,10 @@ namespace HavenSoft.HexManiac.Core.ViewModels { public ViewPort(string fileName, IDataModel model, IWorkDispatcher dispatcher, Singletons singletons = null, MapTutorialsViewModel tutorials = null, IFileSystem fs = null, PythonTool pythonTool = null, ChangeHistory changeHistory = null, EventTemplate eventTemplate = null) { Singletons = singletons ?? new Singletons(); - this.docs = model.Count >= 0x100 && Singletons.DocReference.TryGetValue(model.GetGameCode().Substring(4), out var docs) ? docs : new List(); + this.docs = new List(); + if (model.Count >= 0x100 && Singletons.DocReference.TryGetValue(model.GetGameCode().Substring(4), out var docs)) { + this.docs = docs; + } PythonTool = pythonTool; ownsHistory = changeHistory == null; diff --git a/src/HexManiac.Tests/Before_Baseclass/ScriptTests.cs b/src/HexManiac.Tests/Before_Baseclass/ScriptTests.cs index 7c4e860b..5c771d6e 100644 --- a/src/HexManiac.Tests/Before_Baseclass/ScriptTests.cs +++ b/src/HexManiac.Tests/Before_Baseclass/ScriptTests.cs @@ -14,6 +14,7 @@ namespace HavenSoft.HexManiac.Tests { private readonly ScriptParser battle; public ScriptTests() { + Model.LoadMetadata(BaseModel.GetDefaultMetadatas().First()); // load default script-related lists, like script_compare battle = ViewPort.Tools.CodeTool.BattleScriptParser; }