Skip to content
This repository was archived by the owner on Jan 23, 2020. It is now read-only.

Commit d6594a5

Browse files
committed
enhance the error handling of the get tag api
1 parent eb42e40 commit d6594a5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/context-parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ FastParser.prototype.afterWalk = function (i, input) {};
338338
*
339339
*/
340340
FastParser.prototype.getStartTagName = function() {
341-
return this.tags[0].toLowerCase();
341+
return this.tags[0] !== undefined? this.tags[0].toLowerCase() : undefined;
342342
};
343343

344344
/**
@@ -360,7 +360,7 @@ FastParser.prototype.getCurrentTagIndex = function() {
360360
*
361361
*/
362362
FastParser.prototype.getCurrentTag = function(tagIdx) {
363-
return tagIdx === 0 || tagIdx === 1? this.tags[tagIdx].toLowerCase() : undefined;
363+
return tagIdx === 0 || tagIdx === 1? (this.tags[tagIdx] !== undefined? this.tags[tagIdx].toLowerCase():undefined) : undefined;
364364
};
365365

366366
/**

0 commit comments

Comments
 (0)