Skip to content

Commit 7bbf74b

Browse files
committed
fixed possible missing key exception when user code contains no procedures
1 parent d2ba220 commit 7bbf74b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Rubberduck.Parsing/Symbols/DeclarationFinder.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,10 @@ private IEnumerable<Declaration> FindFormControlHandlers(IReadOnlyList<Declarati
702702
var handlerNames = declarations
703703
.Where(declaration => declaration.IsBuiltIn && declaration.DeclarationType == DeclarationType.Event)
704704
.SelectMany(e => controls.Select(c => c.IdentifierName + "_" + e.IdentifierName));
705+
if (!_userDeclarationsByType.ContainsKey(DeclarationType.Procedure))
706+
{
707+
return Enumerable.Empty<Declaration>();
708+
}
705709
var handlers = _userDeclarationsByType[DeclarationType.Procedure]
706710
.Where(procedure => handlerNames.Contains(procedure.IdentifierName));
707711
return handlers;

0 commit comments

Comments
 (0)