AppModel: Fix crash bug when building multiple times

This commit is contained in:
Katy Coe
2020-07-18 21:23:34 +02:00
parent 6d50ab7546
commit 81f12b3e5b

View File

@@ -107,6 +107,11 @@ namespace Il2CppInspector.Model
// (via the constructor of CppDeclarationGenerator, in InheritanceStyle) // (via the constructor of CppDeclarationGenerator, in InheritanceStyle)
// If no target C++ compiler is specified, it will be set to match the one assumed to have been used to compile the binary // If no target C++ compiler is specified, it will be set to match the one assumed to have been used to compile the binary
public AppModel Build(UnityVersion unityVersion = null, CppCompilerType compiler = CppCompilerType.BinaryFormat) { public AppModel Build(UnityVersion unityVersion = null, CppCompilerType compiler = CppCompilerType.BinaryFormat) {
// Reset in case this is not the first build
Methods.Clear();
Types.Clear();
Strings.Clear();
// Set target compiler // Set target compiler
TargetCompiler = compiler == CppCompilerType.BinaryFormat ? CppCompiler.GuessFromImage(ILModel.Package.BinaryImage) : compiler; TargetCompiler = compiler == CppCompilerType.BinaryFormat ? CppCompiler.GuessFromImage(ILModel.Package.BinaryImage) : compiler;