Skip to content

Commit

Permalink
Prevent crash when starting DynamoSandbox without ASM (#9210)
Browse files Browse the repository at this point in the history
* Prevent crash when starting DynamoSandbox without ASM

* Preserve existing path output behavior, add test case
  • Loading branch information
Dewb authored and QilongTang committed Dec 5, 2018
1 parent b571489 commit 06ee93f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Tools/DynamoShapeManager/Preloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,14 @@ public Preloader(string rootFolder, IEnumerable<Version> versions)
shapeManagerPath = string.Empty; // Folder that contains ASM binaries.
version = Utilities.GetInstalledAsmVersion2(versionList, ref shapeManagerPath, rootFolder);

var libGFolderName = string.Format("libg_{0}_{1}_{2}", version.Major, version.Minor, version.Build);
int major = 0, minor = 0, build = 0;
if (version != null)
{
major = version.Major;
minor = version.Minor;
build = version.Build;
}
var libGFolderName = string.Format("libg_{0}_{1}_{2}", major, minor, build);
preloaderLocation = Path.Combine(rootFolder, libGFolderName);
geometryFactoryPath = Path.Combine(preloaderLocation,
Utilities.GeometryFactoryAssembly);
Expand Down
8 changes: 8 additions & 0 deletions test/DynamoCoreTests/libGPreloaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,13 @@ public void RemapPathShouldReturnEmptyStringForNullPath()
var newPath = DynamoShapeManager.Utilities.RemapOldLibGPathToNewVersionPath(oldPath);
Assert.AreEqual(string.Empty, newPath);
}
[Test]
public void PreloaderThatDoesNotFindASMDoesNotThrow()
{
Assert.DoesNotThrow(() =>
{
var preloader = new Preloader(Path.GetTempPath(), new[] { new Version(999, 999, 999) });
});
}
}
}

0 comments on commit 06ee93f

Please sign in to comment.