fix(core): 🐛 handle null exception for user group

This commit is contained in:
alistair3149 2023-02-10 10:06:06 -05:00 committed by GitHub
parent 3be7e86926
commit 081a176edc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -117,16 +117,18 @@ final class Header extends Partial {
foreach ( $groups as $group ) { foreach ( $groups as $group ) {
$id = sprintf( $msgName, $group ); $id = sprintf( $msgName, $group );
$msg = $this->skin->msg( $id )->text(); $msg = $this->skin->msg( $id )->text();
// Nullpointer should not happen $title = $this->title->newFromText(
$href = $this->title->newFromText(
$this->skin->msg( sprintf( $msgName, $group ) )->text(), $this->skin->msg( sprintf( $msgName, $group ) )->text(),
NS_PROJECT NS_PROJECT
)->getLinkURL(); );
$html .= <<< HTML if ( $title ) {
<li> $href = $title->getLinkURL();
<a href="$href" id="$id">$msg</a> $html .= <<< HTML
</li> <li>
HTML; <a href="$href" id="$id">$msg</a>
</li>
HTML;
}
} }
$html = sprintf( '<li id="pt-usergroups"><ul>%s</ul></li>', $html ); $html = sprintf( '<li id="pt-usergroups"><ul>%s</ul></li>', $html );