Fix crash when generating project files with toolchain setup that fails
#1537
This commit is contained in:
@@ -244,7 +244,19 @@ namespace Flax.Build
|
||||
/// <returns>The toolchain.</returns>
|
||||
public Toolchain TryGetToolchain(TargetArchitecture targetArchitecture)
|
||||
{
|
||||
return HasRequiredSDKsInstalled ? GetToolchain(targetArchitecture) : null;
|
||||
Toolchain result = null;
|
||||
if (HasRequiredSDKsInstalled)
|
||||
{
|
||||
try
|
||||
{
|
||||
result = GetToolchain(targetArchitecture);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Exception(ex);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -260,16 +272,12 @@ namespace Flax.Build
|
||||
if (_toolchains == null)
|
||||
_toolchains = new Dictionary<TargetArchitecture, Toolchain>();
|
||||
|
||||
var key = targetArchitecture;
|
||||
|
||||
Toolchain toolchain;
|
||||
if (_toolchains.TryGetValue(key, out toolchain))
|
||||
{
|
||||
if (_toolchains.TryGetValue(targetArchitecture, out toolchain))
|
||||
return toolchain;
|
||||
}
|
||||
|
||||
toolchain = CreateToolchain(targetArchitecture);
|
||||
_toolchains.Add(key, toolchain);
|
||||
_toolchains.Add(targetArchitecture, toolchain);
|
||||
|
||||
return toolchain;
|
||||
}
|
||||
|
||||
@@ -764,7 +764,7 @@ namespace Flax.Build
|
||||
/// <summary>
|
||||
/// Sorts the directories by name assuming they contain version text. Sorted from lowest to the highest version.
|
||||
/// </summary>
|
||||
/// <param name="file">The paths array to sort.</param>
|
||||
/// <param name="paths">The paths array to sort.</param>
|
||||
public static void SortVersionDirectories(string[] paths)
|
||||
{
|
||||
if (paths == null || paths.Length == 0)
|
||||
|
||||
Reference in New Issue
Block a user