File tree Expand file tree Collapse file tree 4 files changed +20
-10
lines changed
Rubberduck.VBEEditor/SafeComWrappers Expand file tree Collapse file tree 4 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -495,13 +495,17 @@ public override IEnumerable<IFileStatusEntry> Status()
495495 try
496496 {
497497 base . Status ( ) ;
498- return _repo . RetrieveStatus ( new StatusOptions { IncludeUnaltered = true , DetectRenamesInWorkDir = true } )
499- . Select ( item => new FileStatusEntry ( item ) ) ;
498+ return _repo . RetrieveStatus ( new StatusOptions { IncludeUnaltered = true , DetectRenamesInWorkDir = true } )
499+ . Select ( item => new FileStatusEntry ( item ) ) ;
500500 }
501501 catch ( LibGit2SharpException ex )
502502 {
503503 throw new SourceControlException ( SourceControlText . GitRepoStatusFailed , ex ) ;
504504 }
505+ catch ( SEHException ex )
506+ {
507+ throw new SourceControlException ( SourceControlText . GitRepoStatusFailed , ex ) ;
508+ }
505509 }
506510
507511 public override IEnumerable < IFileStatusEntry > LastKnownStatus ( )
Original file line number Diff line number Diff line change @@ -87,7 +87,10 @@ public string Content()
8787
8888 public void Clear ( )
8989 {
90- Target . DeleteLines ( 1 , CountOfLines ) ;
90+ if ( Target . CountOfLines > 0 )
91+ {
92+ Target . DeleteLines ( 1 , CountOfLines ) ;
93+ }
9194 }
9295
9396 /// <summary>
Original file line number Diff line number Diff line change @@ -87,7 +87,10 @@ public string Content()
8787
8888 public void Clear ( )
8989 {
90- Target . DeleteLines ( 1 , CountOfLines ) ;
90+ if ( Target . CountOfLines > 0 )
91+ {
92+ Target . DeleteLines ( 1 , CountOfLines ) ;
93+ }
9194 }
9295
9396 private string _previousContentHash ;
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 IndexOutOfRangeException ( 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