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)
116116 if ( ext == ComponentTypeExtensions . DocClassExtension )
117117 {
118118 var component = this [ name ] ;
119+ if ( component . IsWrappingNullReference )
120+ {
121+ throw new InvalidOperationException ( string . Format ( "Could not find document component named '{0}'." , name ) ) ;
122+ }
119123 component . CodeModule . Clear ( ) ;
120124 component . CodeModule . AddFromString ( codeString ) ;
121125 }
122126 else if ( ext == ComponentTypeExtensions . FormExtension )
123127 {
124- IVBComponent component ;
125- try
126- {
127- component = this [ name ] ;
128- }
129- catch
128+ var component = this [ name ] ;
129+ if ( component . IsWrappingNullReference )
130130 {
131131 component = Add ( ComponentType . UserForm ) ;
132132 component . Properties [ "Caption" ] . Value = name ;
You can’t perform that action at this time.
0 commit comments