[MediaWiki-commits] [Gerrit] mediawiki...ProofreadPage[master]: Makes sure to always return a Title in ProofreadPagePage::fi...

2017-03-29 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
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(-)

Approvals:
  Thcipriani: Looks good to me, approved
  jenkins-bot: Verified



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: merged
Gerrit-Change-Id: I82b2437c898cb32b27cf595e6dcf3b688013d38d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ProofreadPage
Gerrit-Branch: master
Gerrit-Owner: Tpt 
Gerrit-Reviewer: Thcipriani 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...ProofreadPage[master]: Makes sure to always return a Title in ProofreadPagePage::fi...

2017-03-29 Thread Tpt (Code Review)
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 

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