Skip to content

Commit

Permalink
ensures a helpfile is assigned *before* ensuring it is unique
Browse files Browse the repository at this point in the history
Fixes NRE bug introduced by prior commit, that prevented new projects
from parsing.
  • Loading branch information
ThunderFrame committed Jun 7, 2016
1 parent 8d9bc9d commit f4964ac
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Rubberduck.Parsing/VBA/RubberduckParserState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,14 @@ public void AddProject(VBProject project)
return;
}

while (string.IsNullOrEmpty(project.HelpFile) || _projects.Any(a => a.Key == project.HelpFile))
//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();
}
Expand Down

0 comments on commit f4964ac

Please sign in to comment.