Skip to content

Commit

Permalink
Fix IDETECT-4207: ArgumentOutOfIndexException in Windows (#21)
Browse files Browse the repository at this point in the history
* Fix IDETECT-4207: make null check before using the variable

* Addressed PR comment
  • Loading branch information
devmehtabd authored Feb 22, 2024
1 parent 38c77b2 commit 4507761
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ public Container GetContainer()
bool fileNotFound = true;
while (fileNotFound)
{
parentPath =
parentPath.Substring(0, OperatingSystem.IsWindows() ? parentPath.LastIndexOf("\\") : parentPath.LastIndexOf("/"));
string checkFile = Path.Combine(parentPath, projectRelativePath);
if (parentPath.Equals(Path.GetPathRoot(solutionDirectory)) || parentPath.Equals(""))
if (parentPath.Equals("") || parentPath.Equals(Path.GetPathRoot(solutionDirectory)))
{
Console.WriteLine("The Path provided in the sln file is wrong, will skip parsing over this file");
break;
}
parentPath =
parentPath.Substring(0, OperatingSystem.IsWindows() ? parentPath.LastIndexOf("\\") : parentPath.LastIndexOf("/"));
directoryPackagesExists = File.Exists(checkFile);
fileNotFound = !directoryPackagesExists;
projectPath = checkFile;
Expand Down

0 comments on commit 4507761

Please sign in to comment.