fix crash when politis cover not found

This commit is contained in:
quenousimporte 2024-09-11 10:52:41 +02:00
parent 20f3e94007
commit f5fd44291e
1 changed files with 9 additions and 2 deletions

View File

@ -436,8 +436,15 @@
$doc = new DOMDocument(); $doc = new DOMDocument();
$doc->loadHTML($issues); $doc->loadHTML($issues);
$finder = new DomXPath($doc); $finder = new DomXPath($doc);
$cover = $finder->query('//img[contains(@src, "' . $issuenb . '_")]')->item(0)->getAttribute('src'); $cover = $finder->query('//img[contains(@src, "' . $issuenb . '_")]');
$epub->AddImage($cover, 'image/jpeg', true); if ($cover->length)
{
$epub->AddImage($cover->item(0)->getAttribute('src'), 'image/jpeg', true);
}
else
{
echo 'warning: no cover for issue ' . $issuenb . '<br>';
}
// load feeds // load feeds
$feed = file_get_contents($feedurl); $feed = file_get_contents($feedurl);