TopicSubscriptionsPager: Fix exception when no subscriptions

Bug: T362507
Change-Id: I569fb2ae017edc9d8e49910faff85e8c9301077d
This commit is contained in:
Bartosz Dziewoński 2024-04-15 21:03:55 +02:00
parent c7595b012b
commit cf792094bb

View file

@ -36,7 +36,7 @@ class TopicSubscriptionsPager extends TablePager {
private ThreadItemFormatter $threadItemFormatter;
/** @var array<string,DatabaseThreadItem[]> */
private array $threadItemsByName;
private array $threadItemsByName = [];
public function __construct(
IContextSource $context,
@ -55,6 +55,9 @@ class TopicSubscriptionsPager extends TablePager {
* @inheritDoc
*/
public function preprocessResults( $result ) {
if ( !$result->numRows() ) {
return;
}
$lb = $this->linkBatchFactory->newLinkBatch();
$itemNames = [];
foreach ( $result as $row ) {
@ -63,7 +66,6 @@ class TopicSubscriptionsPager extends TablePager {
}
$lb->execute();
$this->threadItemsByName = [];
// Increased limit to allow finding and skipping over some bad permalinks
$threadItems = $this->threadItemStore->findNewestRevisionsByName( $itemNames, $this->mLimit * 5 );
foreach ( $threadItems as $threadItem ) {