File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Rubberduck.VBEEditor/SafeComWrappers/VBA Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,8 @@ public override int GetHashCode()
99
99
100
100
public void ImportSourceFile ( string path )
101
101
{
102
+ if ( IsWrappingNullReference ) { return ; }
103
+
102
104
var ext = Path . GetExtension ( path ) ;
103
105
var name = Path . GetFileNameWithoutExtension ( path ) ;
104
106
if ( ! File . Exists ( path ) )
@@ -152,6 +154,8 @@ public void ImportSourceFile(string path)
152
154
153
155
public void RemoveSafely ( IVBComponent component )
154
156
{
157
+ if ( component . IsWrappingNullReference ) { return ; }
158
+
155
159
switch ( component . Type )
156
160
{
157
161
case ComponentType . ClassModule :
@@ -174,7 +178,7 @@ private static void AttachEvents(VB.VBComponents components)
174
178
{
175
179
lock ( Locker )
176
180
{
177
- if ( _components == null )
181
+ if ( _components == null && components != null )
178
182
{
179
183
_components = components ;
180
184
_componentAdded = OnComponentAdded ;
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ public IReferences References
60
60
61
61
public IVBComponents VBComponents
62
62
{
63
- get { return new VBComponents ( IsWrappingNullReference ? null : Target . VBComponents ) ; }
63
+ get { return new VBComponents ( IsWrappingNullReference || Protection == ProjectProtection . Locked ? null : Target . VBComponents ) ; }
64
64
}
65
65
66
66
public ProjectProtection Protection
@@ -232,4 +232,4 @@ public string ProjectDisplayName
232
232
}
233
233
}
234
234
}
235
- }
235
+ }
You can’t perform that action at this time.
0 commit comments