mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-23 09:59:25 +00:00
handle null token passed to ParseProblem
This commit is contained in:
@@ -16,7 +16,11 @@ class ParseProblem {
|
|||||||
* @param {Severity} severity
|
* @param {Severity} severity
|
||||||
*/
|
*/
|
||||||
constructor(token, message, severity) {
|
constructor(token, message, severity) {
|
||||||
if (Array.isArray(token)) {
|
if (!token || (Array.isArray(token) && !token[0])) {
|
||||||
|
this.startIdx = 0;
|
||||||
|
this.endIdx = 1;
|
||||||
|
}
|
||||||
|
else if (Array.isArray(token)) {
|
||||||
this.startIdx = token[0].range.start;
|
this.startIdx = token[0].range.start;
|
||||||
const lastToken = token[token.length - 1];
|
const lastToken = token[token.length - 1];
|
||||||
this.endIdx = lastToken.range.start + lastToken.range.length;
|
this.endIdx = lastToken.range.start + lastToken.range.length;
|
||||||
|
|||||||
Reference in New Issue
Block a user