File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/PowerShellEditorServices/Workspace Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -83,10 +83,21 @@ public sealed class ScriptRegion : IScriptExtent
83
83
/// </returns>
84
84
public static ScriptRegion Create ( IScriptExtent scriptExtent )
85
85
{
86
+ // IScriptExtent throws an ArgumentOutOfRange exception if Text is null
87
+ string scriptExtentText ;
88
+ try
89
+ {
90
+ scriptExtentText = scriptExtent . Text ;
91
+ }
92
+ catch ( ArgumentOutOfRangeException e )
93
+ {
94
+ scriptExtentText = string . Empty ;
95
+ }
96
+
86
97
return new ScriptRegion
87
98
{
88
99
File = scriptExtent . File ,
89
- Text = scriptExtent . Text ,
100
+ Text = scriptExtentText ,
90
101
StartLineNumber = scriptExtent . StartLineNumber ,
91
102
StartColumnNumber = scriptExtent . StartColumnNumber ,
92
103
StartOffset = scriptExtent . StartOffset ,
You can’t perform that action at this time.
0 commit comments