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()
495
495
try
496
496
{
497
497
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 ) ) ;
500
500
}
501
501
catch ( LibGit2SharpException ex )
502
502
{
503
503
throw new SourceControlException ( SourceControlText . GitRepoStatusFailed , ex ) ;
504
504
}
505
+ catch ( SEHException ex )
506
+ {
507
+ throw new SourceControlException ( SourceControlText . GitRepoStatusFailed , ex ) ;
508
+ }
505
509
}
506
510
507
511
public override IEnumerable < IFileStatusEntry > LastKnownStatus ( )
Original file line number Diff line number Diff line change @@ -87,7 +87,10 @@ public string Content()
87
87
88
88
public void Clear ( )
89
89
{
90
- Target . DeleteLines ( 1 , CountOfLines ) ;
90
+ if ( Target . CountOfLines > 0 )
91
+ {
92
+ Target . DeleteLines ( 1 , CountOfLines ) ;
93
+ }
91
94
}
92
95
93
96
/// <summary>
Original file line number Diff line number Diff line change @@ -87,7 +87,10 @@ public string Content()
87
87
88
88
public void Clear ( )
89
89
{
90
- Target . DeleteLines ( 1 , CountOfLines ) ;
90
+ if ( Target . CountOfLines > 0 )
91
+ {
92
+ Target . DeleteLines ( 1 , CountOfLines ) ;
93
+ }
91
94
}
92
95
93
96
private string _previousContentHash ;
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 IndexOutOfRangeException ( 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