From: Roan Kattouw Date: Wed, 10 Jul 2019 20:15:20 +0000 (-0700) Subject: WatchedItemStore: Fix fatal when revision is deleted X-Git-Tag: 1.34.0-rc.0~1057^2 X-Git-Url: http://git.cyclocoop.org/data/%24%7Bnav_urls/membership/href%7D?a=commitdiff_plain;h=881e17a0c712076daacf06a65bce3b64fafec477;p=lhc%2Fweb%2Fwiklou.git 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 --- 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.