Skip to content

Commit

Permalink
Prevent from NPE when there's a validation error
Browse files Browse the repository at this point in the history
Fixes eclipse-lemminx#927

Signed-off-by: azerr <azerr@redhat.com>
  • Loading branch information
angelozerr committed Nov 10, 2020
1 parent a1c820e commit 9c1891b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ public LSPErrorReporterForXML(DOMDocument xmlDocument, List<Diagnostic> diagnost
@Override
protected Range toLSPRange(XMLLocator location, String key, Object[] arguments, String message,
DiagnosticSeverity diagnosticSeverity, boolean fatalError, DOMDocument document) {
String documentURI = location.getExpandedSystemId();
boolean errorForDocument = documentURI.endsWith(document.getDocumentURI());
String documentURI = location.getExpandedSystemId();
boolean errorForDocument = documentURI != null ? documentURI.endsWith(document.getDocumentURI()) : true;
// try adjust positions for XML syntax error
XMLSyntaxErrorCode syntaxCode = XMLSyntaxErrorCode.get(key);
if (syntaxCode != null) {
Expand Down

0 comments on commit 9c1891b

Please sign in to comment.