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); $p->parentNode->removeChild($p);
} }
$firstP = $doc->getElementsByTagName("p")->item(0); if (($firstP = $doc->getElementsByTagName("p")->item(0)) !== null) {
if (strpos($doc->saveHTML($firstP), 'geohack') !== false) { if (($firstPhtml = $doc->saveHTML($firstP)) !== false) {
if ($firstP !== null && $firstP->parentNode !== null) $firstP->parentNode->removeChild($firstP); if (strpos($firstPhtml, 'geohack') !== false) {
if ($firstP->parentNode !== null) $firstP->parentNode->removeChild($firstP);
}
}
} }
/* /*