Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js |
— | — | @@ -158,12 +158,12 @@ |
159 | 159 | }, |
160 | 160 | 'success': function( data ) { |
161 | 161 | var context = this; |
162 | | - if ( typeof data.query.articlefeedback == 'undefined' ) { |
| 162 | + if ( !$.isArray( data.query.articlefeedback ) ) { |
163 | 163 | // TODO: Something more clever, and useful, about this error |
164 | 164 | mw.log( '<loadReport success with bad data />' ); |
165 | 165 | return; |
166 | 166 | } |
167 | | - if ( 'expertise' in data.query.articlefeedback[0] ) { |
| 167 | + if ( data.query.articlefeedback.length && 'expertise' in data.query.articlefeedback[0] ) { |
168 | 168 | var $expertise = context.$ui.find( '.articleFeedback-expertise' ); |
169 | 169 | var tags = data.query.articlefeedback[0].expertise.split( '|' ); |
170 | 170 | for ( var i = 0; i < tags.length; i++ ) { |