Check for empty response

In combination with other gadgets the error
TypeError: re.query is undefined
can occur because the request contains titles:'' and the response is [].

Change-Id: I46d02e7c48a55cd9af20fd7ef729b4d26f69a8c0
This commit is contained in:
Fomafix 2014-06-18 20:57:19 +00:00 committed by [[mw:User:Fomafix]]
parent 0192822522
commit 58be4ea1de

View file

@ -33,7 +33,7 @@
var
href = link.attr( 'href' ),
title = link.data( 'title' ),
deferred = $.Deferred();
deferred = $.Deferred();
mw.popups.render.currentRequest = mw.popups.api.get( {
action: 'query',
@ -57,6 +57,7 @@
mw.popups.render.currentRequest = undefined;
if (
!re.query ||
!re.query.pages ||
!re.query.pages[ re.query.pageids[ 0 ] ].extract ||
re.query.pages[ re.query.pageids[ 0 ] ].extract === ''