Add null check before using path/ext values.
This commit is contained in:
Родитель
00a44301a0
Коммит
ebd42c50a9
|
@ -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(';');
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче