Skip to content

Commit

Permalink
fix: null reference in relative link rule
Browse files Browse the repository at this point in the history
  • Loading branch information
zregvart committed Nov 2, 2020
1 parent c36ce15 commit b94b2a8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ class RelativeLinks extends Rule {

setup() {
this.on("dom:ready", event => {
event.document.querySelectorAll('a').forEach(a => {
const href = a.getAttribute("href").value;
if (href && href.startsWith("https://camel.apache.org")) {
const anchors = event.document.querySelectorAll('a');
if (anchors === null) {
return;
}
anchors.forEach(a => {
const href = a.getAttribute("href");
if (href && href.value.startsWith("https://camel.apache.org")) {
this.report(a, `For links within camel.apache.org use relative links, found: ${href}`);
}
});
Expand Down

0 comments on commit b94b2a8

Please sign in to comment.