Skip to content

Commit 81d8091

Browse files
committed
Fix Bomb
1 parent 5345e66 commit 81d8091

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Rubberduck.VBEEditor/Extensions/VBComponentExtensions.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ public static void ExportAsSourceFile(this VBComponent component, string directo
2121
string filePath = Path.Combine(directoryPath, component.Name + component.Type.FileExtension());
2222
if (component.Type == vbext_ComponentType.vbext_ct_Document)
2323
{
24-
var text = component.CodeModule.get_Lines(1, component.CodeModule.CountOfLines);
25-
File.WriteAllText(filePath, text);
24+
int lineCount = component.CodeModule.CountOfLines;
25+
if (lineCount > 0)
26+
{
27+
var text = component.CodeModule.get_Lines(1, lineCount);
28+
File.WriteAllText(filePath, text);
29+
}
2630
}
2731
else
2832
{

0 commit comments

Comments
 (0)