File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Rubberduck.VBEEditor/SafeComWrappers/VBA Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -116,17 +116,17 @@ public void ImportSourceFile(string path)
116
116
if ( ext == ComponentTypeExtensions . DocClassExtension )
117
117
{
118
118
var component = this [ name ] ;
119
+ if ( component . IsWrappingNullReference )
120
+ {
121
+ throw new InvalidOperationException ( string . Format ( "Could not find document component named '{0}'." , name ) ) ;
122
+ }
119
123
component . CodeModule . Clear ( ) ;
120
124
component . CodeModule . AddFromString ( codeString ) ;
121
125
}
122
126
else if ( ext == ComponentTypeExtensions . FormExtension )
123
127
{
124
- IVBComponent component ;
125
- try
126
- {
127
- component = this [ name ] ;
128
- }
129
- catch
128
+ var component = this [ name ] ;
129
+ if ( component . IsWrappingNullReference )
130
130
{
131
131
component = Add ( ComponentType . UserForm ) ;
132
132
component . Properties [ "Caption" ] . Value = name ;
You can’t perform that action at this time.
0 commit comments