1
0
Форкнуть 0

Add null check before using path/ext values.

This commit is contained in:
J Wyman 2017-08-01 14:11:32 -04:00
Родитель 00a44301a0
Коммит ebd42c50a9
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -49,6 +49,13 @@ namespace Microsoft.Alm.Git
string pathext = Environment.GetEnvironmentVariable("PATHEXT");
string envpath = Environment.GetEnvironmentVariable("PATH");
if (string.IsNullOrEmpty(pathext) || string.IsNullOrEmpty(envpath))
{
// The user is likely hosed, or a poorly crafted test case - eitherway avoid NRE from the .Split call.
path = null;
return false;
}
string[] exts = pathext.Split(';');
string[] paths = envpath.Split(';');