From 36e73a314bf6b303fe9066d4535b73f17b766c5b Mon Sep 17 00:00:00 2001 From: Gerben Date: Wed, 3 Jul 2019 01:35:38 +0200 Subject: [PATCH] Catch errors that now appear. (WIP) --- lib/Controller/MementoFinder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Controller/MementoFinder.php b/lib/Controller/MementoFinder.php index 4bb53d5..193567d 100644 --- a/lib/Controller/MementoFinder.php +++ b/lib/Controller/MementoFinder.php @@ -182,6 +182,7 @@ function extractMementoInfo($file) { $content = $file->getContent(); $DOM = new DOMDocument; $DOM->loadHTML($content); + if (!$DOM->documentElement) return null; // possibly $content was not HTML at all. $headElement = $DOM->documentElement->getElementsByTagName('head')[0]; if (!$headElement) return null; // possibly $content was not HTML at all. $originalUrls = getOriginalUrls($headElement);