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

Change subject: Makes sure to always return a Title in 
ProofreadPagePage::findIndexTitle
......................................................................

Makes sure to always return a Title in ProofreadPagePage::findIndexTitle

Change-Id: I82b2437c898cb32b27cf595e6dcf3b688013d38d
Task: T161734
---
M includes/page/ProofreadPagePage.php
1 file changed, 2 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage 
refs/changes/21/345421/1

diff --git a/includes/page/ProofreadPagePage.php 
b/includes/page/ProofreadPagePage.php
index 9fa3a49..b1e464e 100644
--- a/includes/page/ProofreadPagePage.php
+++ b/includes/page/ProofreadPagePage.php
@@ -118,7 +118,7 @@
                foreach ( $result as $x ) {
                        $refTitle = Title::makeTitle( $x->page_namespace, 
$x->page_title );
                        if ( $refTitle !== null && $refTitle->inNamespace( 
ProofreadPage::getIndexNamespaceId() ) ) {
-                               if ( $refTitle->equals( $possibleIndexTitle ) ) 
{ // It is the same as the linked file, we know it's this Index:
+                               if ( $possibleIndexTitle !== null && 
$refTitle->equals( $possibleIndexTitle ) ) { // It is the same as the linked 
file, we know it's this Index:
                                        return $refTitle;
                                }
                                $indexesThatLinksHere[] = $refTitle;
@@ -126,8 +126,7 @@
                }
                if ( !empty( $indexesThatLinksHere ) ) {
                        // TODO: what should we do if there are more than 1 
possible index?
-                       $this->index = ProofreadIndexPage::newFromTitle( 
$indexesThatLinksHere[0] );
-                       return $this->index;
+                       return reset( $indexesThatLinksHere );
                }
 
                return $possibleIndexTitle;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I82b2437c898cb32b27cf595e6dcf3b688013d38d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ProofreadPage
Gerrit-Branch: master
Gerrit-Owner: Tpt <thoma...@hotmail.fr>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to