From bef4ba1829f4012683c78168beeeea8bbd13a16b Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 19 Feb 2023 18:17:51 +0100 Subject: [PATCH] Fix crash when cross-compiling C# bindings-only without toolchain installed --- Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs index 76ef5d805..56419d87c 100644 --- a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs +++ b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs @@ -245,7 +245,7 @@ namespace Flax.Build.Bindings public static void GenerateCppVirtualWrapperCallBaseMethod(BuildData buildData, StringBuilder contents, VirtualClassInfo classInfo, FunctionInfo functionInfo, string scriptVTableBase, string scriptVTableOffset) { contents.AppendLine(" // Prevent stack overflow by calling native base method"); - if (buildData.Toolchain.Compiler == TargetCompiler.Clang) + if (buildData.Toolchain?.Compiler == TargetCompiler.Clang) { // Clang compiler // TODO: secure VTableFunctionInjector with mutex (even at cost of performance) @@ -1453,7 +1453,7 @@ namespace Flax.Build.Bindings } var t = functionInfo.IsConst ? " const" : string.Empty; contents.AppendLine($" typedef {functionInfo.ReturnType} ({classInfo.NativeName}::*{functionInfo.UniqueName}_Signature)({thunkParams}){t};"); - if (buildData.Toolchain.Compiler != TargetCompiler.Clang) + if (buildData.Toolchain?.Compiler != TargetCompiler.Clang) { // MSVC or other compiler contents.AppendLine($" typedef {functionInfo.ReturnType} ({classInfo.NativeName}Internal::*{functionInfo.UniqueName}_Internal_Signature)({thunkParams}){t};"); @@ -1526,7 +1526,7 @@ namespace Flax.Build.Bindings } // Native interfaces override in managed code requires vtables hacking which requires additional inject on Clang-platforms - if (buildData.Toolchain.Compiler == TargetCompiler.Clang && classInfo.IsClass && classInfo.Interfaces != null) + if (buildData.Toolchain?.Compiler == TargetCompiler.Clang && classInfo.IsClass && classInfo.Interfaces != null) { // Override vtable entries of interface methods (for each virtual function in each interface) foreach (var interfaceInfo in classInfo.Interfaces) @@ -2374,7 +2374,7 @@ namespace Flax.Build.Bindings contents.AppendLine(); // Native interfaces override in managed code requires vtables hacking which requires additional inject on Clang-platforms - if (buildData.Toolchain.Compiler == TargetCompiler.Clang) + if (buildData.Toolchain?.Compiler == TargetCompiler.Clang) { // Generate functions that inject script wrappers into vtable entry foreach (var functionInfo in interfaceInfo.Functions)