r81278 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81277‎ | r81278 | r81279 >
Date:22:35, 31 January 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Fixed JS error when no data exists yet.
Modified paths:
  • /trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js
@@ -158,12 +158,12 @@
159159 },
160160 'success': function( data ) {
161161 var context = this;
162 - if ( typeof data.query.articlefeedback == 'undefined' ) {
 162+ if ( !$.isArray( data.query.articlefeedback ) ) {
163163 // TODO: Something more clever, and useful, about this error
164164 mw.log( '<loadReport success with bad data />' );
165165 return;
166166 }
167 - if ( 'expertise' in data.query.articlefeedback[0] ) {
 167+ if ( data.query.articlefeedback.length && 'expertise' in data.query.articlefeedback[0] ) {
168168 var $expertise = context.$ui.find( '.articleFeedback-expertise' );
169169 var tags = data.query.articlefeedback[0].expertise.split( '|' );
170170 for ( var i = 0; i < tags.length; i++ ) {

Status & tagging log