Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
`getInnerText` might receive a null DOMElement if the xpath or query return no element.
  • Loading branch information
j0k3r committed Feb 29, 2016
1 parent 8ab7d76 commit c756ec0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Readability.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,6 @@ public function addPostFilter($filter, $replacer = '')
* Load HTML in a DOMDocument.
* Apply Pre filters
* Cleanup HTML using Tidy (or not).
*
* @return [type] [description]
*/
private function loadHtml()
{
Expand Down Expand Up @@ -1053,9 +1051,9 @@ protected function grabArticle(\DOMElement $page = null)
*
* @return string
*/
public function getInnerText(\DOMElement $e, $normalizeSpaces = true, $flattenLines = false)
public function getInnerText(\DOMElement $e = null, $normalizeSpaces = true, $flattenLines = false)
{
if (!isset($e->textContent) || $e->textContent === '') {
if (null === $e || !isset($e->textContent) || $e->textContent === '') {
return '';
}

Expand Down

0 comments on commit c756ec0

Please sign in to comment.