Skip to content

Commit

Permalink
fix LinkAdder filter (#176)
Browse files Browse the repository at this point in the history
* fix LinkAdder filter

I assumed a case where $node is empty

* fix StyleCI
  • Loading branch information
kijtra authored and freekmurze committed Jul 27, 2018
1 parent 50e5249 commit a9c38ee
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/LinkAdder.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public function addFromHtml(string $html, UriInterface $foundOnUrl)
return $this->normalizeUrl($url);
})
->filter(function (UriInterface $url) use ($foundOnUrl) {
$node = $this->crawler->addToDepthTree($url, $foundOnUrl);
if (! $node = $this->crawler->addToDepthTree($url, $foundOnUrl)) {
return false;
}

return $this->shouldCrawl($node);
})
Expand Down

0 comments on commit a9c38ee

Please sign in to comment.