Don't attempt to get surrounding text of error when we don't have access to script string anymore.

This commit is contained in:
Deukhoofd 2019-02-21 12:19:11 +01:00
parent 40745a1935
commit f1ae0af244
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 3 additions and 1 deletions

View File

@ -33,7 +33,9 @@ namespace Upsilon
{
if (ThrowsOnError)
{
var text = ScriptString.GetSpan(location);
string text = string.Empty;
if (ScriptString != null)
text = ScriptString.GetSpan(location);
throw new ParseException(FileName, message, location.StartLine, location.StartPosition, text);
}
Log(DiagnosticLevel.Error, message, location);