Skip to content

Commit

Permalink
Merge pull request #1723 from ThunderFrame/next
Browse files Browse the repository at this point in the history
Careful assignment of ProjectID - Avoids project collisions
  • Loading branch information
retailcoder committed Jun 7, 2016
2 parents 7123cac + f4964ac commit 88cb6c2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Rubberduck.Parsing/VBA/RubberduckParserState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,18 @@ public void AddProject(VBProject project)
return;
}

//assign a hashcode if no helpfile is present
if (string.IsNullOrEmpty(project.HelpFile))
{
project.HelpFile = project.GetHashCode().ToString();
}

//loop until the helpfile is unique for this host session
while (_projects.Any(a => a.Key == project.HelpFile))
{
project.HelpFile = (project.GetHashCode() ^ project.HelpFile.GetHashCode()).ToString();
}

var projectId = project.HelpFile;
if (!_projects.ContainsKey(projectId))
{
Expand Down

0 comments on commit 88cb6c2

Please sign in to comment.