mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-17 02:51:45 -05:00
handle null ref exceptions in managed parser (#1606)
* handle null ref exceptions * add comment
This commit is contained in:
@@ -229,7 +229,8 @@ namespace Microsoft.SqlTools.ServiceLayer.BatchParser
|
||||
}
|
||||
|
||||
// get number of characters in the last line
|
||||
int endColumn = prevLine.ToCharArray().Length;
|
||||
// for some SQLCMD scenarios, the reader is already at the end of file and causing the prevLine to be null.
|
||||
int endColumn = prevLine == null ? 0 : prevLine.ToCharArray().Length;
|
||||
|
||||
return new BatchDefinition(
|
||||
batchText,
|
||||
@@ -263,7 +264,8 @@ namespace Microsoft.SqlTools.ServiceLayer.BatchParser
|
||||
}
|
||||
|
||||
// get number of characters in the last line
|
||||
int endColumn = prevLine.ToCharArray().Length;
|
||||
// for some SQLCMD scenarios, the reader is already at the end of file and causing the prevLine to be null.
|
||||
int endColumn = prevLine == null ? 0 : prevLine.ToCharArray().Length;
|
||||
|
||||
//lineOffset doesn't matter because its the last batch
|
||||
return Tuple.Create(endLine, endColumn);
|
||||
|
||||
Reference in New Issue
Block a user