Adrian Lang has uploaded a new change for review.

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

Change subject: Check result of getEntityRevision
......................................................................

Check result of getEntityRevision

EntityRevisionLookup::getEntityRevision can return null. 
EntityRevision::getRevision
cannot return null, on the other hand.

Bug: T90268
Change-Id: I6f9aa793a2d9f1034f57ac7c59a06e9aba242913
---
M repo/includes/View/EntityViewPlaceholderExpander.php
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/19/192519/1

diff --git a/repo/includes/View/EntityViewPlaceholderExpander.php 
b/repo/includes/View/EntityViewPlaceholderExpander.php
index e2d7f18..d1f0892 100644
--- a/repo/includes/View/EntityViewPlaceholderExpander.php
+++ b/repo/includes/View/EntityViewPlaceholderExpander.php
@@ -246,16 +246,18 @@
                try {
                        // we may want to cache this...
                        $entityRev = 
$this->entityRevisionLookup->getEntityRevision( $entityId, $revisionId );
-                       $entity = $entityRev->getEntity();
                } catch ( StorageException $ex ) {
-                       // could not load entity, might be a deleted revision
+                       // Could not load entity revision, $revisionId might be 
a deleted revision
                        return '';
                }
 
-               if ( !$entity ) {
+               if ( !$entityRev ) {
+                       // Could not load entity revision, $revisionId might be 
a non-entity revision
                        return '';
                }
 
+               $entity = $entityRev->getEntity();
+
                $entityTermsView = new EntityTermsView(
                        $this->templateFactory,
                        null,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f9aa793a2d9f1034f57ac7c59a06e9aba242913
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Adrian Lang <adrian.he...@wikimedia.de>

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

Reply via email to