Tpt has uploaded a new change for review. https://gerrit.wikimedia.org/r/56737
Change subject: Fix an error in the lua api when the entity has no label or sitelink ...................................................................... Fix an error in the lua api when the entity has no label or sitelink If an entity has no label the entry "labels" doesn't exists in the table and made the script fail. Idem for sitelinks. Change-Id: I220996203ac88890ea8a2c50193e0932a907ddcd --- M client/resources/mw.wikibase.lua 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/37/56737/1 diff --git a/client/resources/mw.wikibase.lua b/client/resources/mw.wikibase.lua index a696ce8..721da00 100644 --- a/client/resources/mw.wikibase.lua +++ b/client/resources/mw.wikibase.lua @@ -38,14 +38,14 @@ local code = mw.language.getContentLanguage():getCode() if code == nil then return nil end local entity = php.getEntity( id ) - if entity == nil then return nil end + if entity == nil or entity.labels == nil then return nil end local label = entity.labels[code] if label == nil then return nil end return label.value end wikibase.sitelink = function ( id ) local entity = php.getEntity( id ) - if entity == nil then return nil end + if entity == nil or entity.sitelinks == nil then return nil end local globalSiteId = php.getGlobalSiteId() if globalSiteId == nil then return nil end local sitelink = entity.sitelinks[globalSiteId] -- To view, visit https://gerrit.wikimedia.org/r/56737 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I220996203ac88890ea8a2c50193e0932a907ddcd Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Tpt <thoma...@hotmail.fr> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits