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

This commit is contained in:
2019-02-21 12:19:11 +01:00
parent 40745a1935
commit f1ae0af244

View File

@@ -33,7 +33,9 @@ namespace Upsilon
{ {
if (ThrowsOnError) 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); throw new ParseException(FileName, message, location.StartLine, location.StartPosition, text);
} }
Log(DiagnosticLevel.Error, message, location); Log(DiagnosticLevel.Error, message, location);