Check for null after Title::newFromText

Title::newFromText returns null on invalid title.

Change-Id: Iaef69584eff33b1b13669f8d0a3b8eeeba3755cc
This commit is contained in:
Fomafix 2022-11-10 19:27:04 +00:00
parent abbc5c5e32
commit cf8538086c

View file

@ -468,9 +468,7 @@ class CategoryTree {
foreach ( $res as $row ) {
$title = Title::newFromText( $row->page_title, $row->page_namespace );
// Page name could have slashes, check the subpage for valid language built-in codes
$isValidLangCode = $title->getSubpageText();
if ( $title !== null && $isValidLangCode ) {
if ( $title !== null && $title->getSubpageText() ) {
$lb->addObj( $title->getBaseTitle() );
}
}