Fix type safety error

This commit is contained in:
Joshua Ramon Enslin 2022-09-15 21:35:36 +02:00
parent 5819caff91
commit 1a9b195067
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -395,9 +395,12 @@ final class NodaWikidataFetcher {
$p->parentNode->removeChild($p);
}
$firstP = $doc->getElementsByTagName("p")->item(0);
if (strpos($doc->saveHTML($firstP), 'geohack') !== false) {
if ($firstP !== null && $firstP->parentNode !== null) $firstP->parentNode->removeChild($firstP);
if (($firstP = $doc->getElementsByTagName("p")->item(0)) !== null) {
if (($firstPhtml = $doc->saveHTML($firstP)) !== false) {
if (strpos($firstPhtml, 'geohack') !== false) {
if ($firstP->parentNode !== null) $firstP->parentNode->removeChild($firstP);
}
}
}
/*