Skip to content

Commit a2971ea

Browse files
committed
VBComponents:
- Added nullchecks to ImportSourceFile() and RemoveSafely()
1 parent 8c23b70 commit a2971ea

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Rubberduck.VBEEditor/SafeComWrappers/VBA/VBComponents.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void ImportSourceFile(string path)
101101
{
102102
var ext = Path.GetExtension(path);
103103
var name = Path.GetFileNameWithoutExtension(path);
104-
if (!File.Exists(path))
104+
if (!File.Exists(path) || this[name] == null)
105105
{
106106
return;
107107
}
@@ -152,6 +152,9 @@ public void ImportSourceFile(string path)
152152

153153
public void RemoveSafely(IVBComponent component)
154154
{
155+
if (component == null)
156+
{ return; }
157+
155158
switch (component.Type)
156159
{
157160
case ComponentType.ClassModule:

0 commit comments

Comments
 (0)