From d892b1376809c454980ce7083e6cee67d47e6b26 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 14 Mar 2018 10:51:24 +0100 Subject: Fix error C14N I have the error: "Call to a member function C14N() on null" You could reproduce like this: - try to parse a url like http://www.dailymotion.com/video/x6ga6qi that doesn't return any content - this throw an exception and the logs show "[Parsing] Could not parse text, giving up :(" - now, call ->getContent() with the same object readability Previously, getContent would return "null" but now it call ->C14N() on a NULL object. --- src/Readability.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Readability.php b/src/Readability.php index 91e703c..cffe4f0 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -1564,7 +1564,7 @@ class Readability */ public function getContent() { - return $this->content->C14N(); + return (null !== $this->content) ? $this->content->C14N() : null; } /** -- cgit v1.2.3