Skip to content

Commit f4964ac

Browse files
committed
ensures a helpfile is assigned *before* ensuring it is unique
Fixes NRE bug introduced by prior commit, that prevented new projects from parsing.
1 parent 8d9bc9d commit f4964ac

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Rubberduck.Parsing/VBA/RubberduckParserState.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,14 @@ public void AddProject(VBProject project)
8383
return;
8484
}
8585

86-
while (string.IsNullOrEmpty(project.HelpFile) || _projects.Any(a => a.Key == project.HelpFile))
86+
//assign a hashcode if no helpfile is present
87+
if (string.IsNullOrEmpty(project.HelpFile))
88+
{
89+
project.HelpFile = project.GetHashCode().ToString();
90+
}
91+
92+
//loop until the helpfile is unique for this host session
93+
while (_projects.Any(a => a.Key == project.HelpFile))
8794
{
8895
project.HelpFile = (project.GetHashCode() ^ project.HelpFile.GetHashCode()).ToString();
8996
}

0 commit comments

Comments
 (0)