Commit 962c486
Prevent NRE when Android SDK is not found (#73)
Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/938504
In dc00a39, we added a search path for the NDK which is now
*inside* the Android SDK. However, this change could produce a
`NullReferenceException` if the Android SDK is not found.
In cases where an Android SDK is not found, and the `AndroidSdkPath`
property is null, we still go on to use the null property when
locating the Android NDK:
var sdks = GetAllAvailableAndroidSdks().ToList();
sdks.Add(AndroidSdkPath);
foreach(var sdk in sdks.Distinct())
if (Directory.Exists(ndk = Path.Combine(sdk, "ndk-bundle")))
The `Path.Combine` will throw if you pass in a null.
This fix doesn't *solve* the exception, as you will still get an
`InvalidOperationException` for the missing Android SDK. However, that
is certainly a more descriptive error message than a
`NullReferenceException`.1 parent 9b03310 commit 962c486
File tree
1 file changed
+2
-1
lines changed- src/Xamarin.Android.Tools.AndroidSdk/Sdks
1 file changed
+2
-1
lines changedLines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
| 244 | + | |
| 245 | + | |
245 | 246 | | |
246 | 247 | | |
247 | 248 | | |
| |||
0 commit comments