From 881e17a0c712076daacf06a65bce3b64fafec477 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 10 Jul 2019 13:15:20 -0700 Subject: [PATCH] WatchedItemStore: Fix fatal when revision is deleted People following links from their watchlist emails to since-deleted revisions were getting fatals from WatchedItemStore::getNotificationTimestamp(). It's hard to tell whether returning null or false is the right thing to do here, because this function can return both and the difference is not documented, and I wasn't able to find any callers that care about the distinction. Bug: T226741 Change-Id: Ib2a836099343f4c161227266dbeeafbc76dccc2b --- includes/watcheditem/WatchedItemStore.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/watcheditem/WatchedItemStore.php b/includes/watcheditem/WatchedItemStore.php index 1a39945067..d33b6ae303 100644 --- a/includes/watcheditem/WatchedItemStore.php +++ b/includes/watcheditem/WatchedItemStore.php @@ -1120,6 +1120,11 @@ class WatchedItemStore implements WatchedItemStoreInterface, StatsdAwareInterfac } $oldRev = $this->revisionLookup->getRevisionById( $oldid ); + if ( !$oldRev ) { + // Oldid given but does not exist (probably deleted) + return false; + } + $nextRev = $this->revisionLookup->getNextRevision( $oldRev ); if ( !$nextRev ) { // Oldid given and is the latest revision for this title; clear the timestamp. -- 2.20.1