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 eddf5aa
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public LSPErrorReporterForXML(DOMDocument xmlDocument, List<Diagnostic> diagnost
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());
boolean errorForDocument = documentURI != null ? documentURI.endsWith(document.getDocumentURI()) : false;
// try adjust positions for XML syntax error
XMLSyntaxErrorCode syntaxCode = XMLSyntaxErrorCode.get(key);
if (syntaxCode != null) {
Expand Down

0 comments on commit eddf5aa

Please sign in to comment.