Skip to content

Commit 4f717b6

Browse files
bratschedellis1972
authored andcommitted
Check if the path exists before trying to enumerate it. (#67)
Fixes VSTS #826178
1 parent 66d445c commit 4f717b6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Xamarin.Android.Tools.AndroidSdk/Sdks/AndroidSdkBase.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ public virtual void Initialize (string androidSdkPath = null, string androidNdkP
9090
if (!string.IsNullOrEmpty (AndroidNdkPath)) {
9191
// It would be nice if .NET had real globbing support in System.IO...
9292
string toolchainsDir = Path.Combine (AndroidNdkPath, "toolchains");
93-
IsNdk64Bit = Directory.EnumerateDirectories (toolchainsDir, "arm-linux-androideabi-*")
94-
.Any (dir => Directory.Exists (Path.Combine (dir, "prebuilt", NdkHostPlatform64Bit)));
93+
if (Directory.Exists (toolchainsDir)) {
94+
IsNdk64Bit = Directory.EnumerateDirectories (toolchainsDir, "arm-linux-androideabi-*")
95+
.Any (dir => Directory.Exists (Path.Combine (dir, "prebuilt", NdkHostPlatform64Bit)));
96+
}
9597
}
9698
// we need to look for extensions other than the default .exe|.bat
9799
// google have a habbit of changing them.

0 commit comments

Comments
 (0)