Matthias Mullie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/240336

Change subject: Don't attempt to render block if none of the lines can be shown
......................................................................

Don't attempt to render block if none of the lines can be shown

Not only doesn't it make sense to render this, getLogText has
some assumptions about this array, and an empty array just didn't
work.

Bug: T112738
Change-Id: Ibdc0c4ed15449883a91a3292bfa174ff84116be0
---
M includes/changes/EnhancedChangesList.php
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/36/240336/1

diff --git a/includes/changes/EnhancedChangesList.php 
b/includes/changes/EnhancedChangesList.php
index d912e3a..1dcb7ae 100644
--- a/includes/changes/EnhancedChangesList.php
+++ b/includes/changes/EnhancedChangesList.php
@@ -283,6 +283,10 @@
                // Further down are some assumptions that $block is a 0-indexed 
array
                // with (count-1) as last key. Let's make sure it is.
                $block = array_values( $block );
+               if ( empty( $block ) ) {
+                       // if we can't show anything, don't display this block 
altogether
+                       return '';
+               }
 
                $r .= $this->getLogText( $block, $queryParams, $allLogs, 
$isnew, $namehidden );
 
@@ -453,6 +457,10 @@
         * @return string
         */
        protected function getLogText( $block, $queryParams, $allLogs, $isnew, 
$namehidden ) {
+               if ( empty( $block ) ) {
+                       return '';
+               }
+
                # Changes message
                static $nchanges = array();
                static $sinceLastVisitMsg = array();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibdc0c4ed15449883a91a3292bfa174ff84116be0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org>

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

Reply via email to