diff --git a/modules/@angular/compiler/src/html_parser.ts b/modules/@angular/compiler/src/html_parser.ts index 0611c3197d..141b6f94b3 100644 --- a/modules/@angular/compiler/src/html_parser.ts +++ b/modules/@angular/compiler/src/html_parser.ts @@ -295,7 +295,9 @@ class TreeBuilder { var fullName = getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getParentElement()); - this._getParentElement().endSourceSpan = endTagToken.sourceSpan; + if (this._getParentElement()) { + this._getParentElement().endSourceSpan = endTagToken.sourceSpan; + } if (getHtmlTagDefinition(fullName).isVoid) { this.errors.push( diff --git a/modules/@angular/compiler/test/html_parser_spec.ts b/modules/@angular/compiler/test/html_parser_spec.ts index 2466b65520..d6067dc4fd 100644 --- a/modules/@angular/compiler/test/html_parser_spec.ts +++ b/modules/@angular/compiler/test/html_parser_spec.ts @@ -343,6 +343,12 @@ export function main() { expect(humanizeErrors(errors)).toEqual([['p', 'Unexpected closing tag "p"', '0:5']]); }); + it('should report subsequent open tags without proper close tag', () => { + let errors = parser.parse('