Dereckson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350914 )

Change subject: Fix EnhancedChangesList::getDiffHistLinks null exception
......................................................................

Fix EnhancedChangesList::getDiffHistLinks null exception

This fixes MediaWiki\Linker\LinkRenderer::makeKnownLink() must implement
interface MediaWiki\Linker\LinkTarget, null given on Special:Watchlist
exception when trying to load a watchlist in some circumstances an entry
doesn't have an associated title.

Bug: T164059
Change-Id: I451d6b5c544755b2ecbea16477d016cdaa935852
---
M includes/changes/EnhancedChangesList.php
1 file changed, 15 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/14/350914/1

diff --git a/includes/changes/EnhancedChangesList.php 
b/includes/changes/EnhancedChangesList.php
index b8a2ac8..e695c34 100644
--- a/includes/changes/EnhancedChangesList.php
+++ b/includes/changes/EnhancedChangesList.php
@@ -708,20 +708,28 @@
         * @return string HTML
         */
        public function getDiffHistLinks( RCCacheEntry $rc, array $query ) {
-               $pageTitle = $rc->getTitle();
                if ( $rc->getAttribute( 'rc_type' ) == RC_CATEGORIZE ) {
                        // For categorizations we must swap the category title 
with the page title!
                        $pageTitle = Title::newFromID( $rc->getAttribute( 
'rc_cur_id' ) );
+               } else {
+                       $pageTitle = $rc->getTitle();
+               }
+
+               if ( $pageTitle === null ) {
+                       $link = $this->msg( 'mw-changeslist-unknown' );
+               } else {
+                       $link = $this->linkRenderer->makeKnownLink(
+                                       $pageTitle,
+                                       new HtmlArmor( $this->message['hist'] ),
+                                       [ 'class' => 'mw-changeslist-history' ],
+                                       $query
+                               );
                }
 
                $retVal = ' ' . $this->msg( 'parentheses' )
                                ->rawParams( $rc->difflink . 
$this->message['pipe-separator']
-                                       . $this->linkRenderer->makeKnownLink(
-                                               $pageTitle,
-                                               new HtmlArmor( 
$this->message['hist'] ),
-                                               [ 'class' => 
'mw-changeslist-history' ],
-                                               $query
-                                       ) )->escaped();
+                                       . $link
+                                       )->escaped();
                return $retVal;
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/350914
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I451d6b5c544755b2ecbea16477d016cdaa935852
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Dereckson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to