Make WordPress Core

Changeset 32916


Ignore:
Timestamp:
06/23/2015 07:42:50 PM (11 years ago)
Author:
wonderboymusic
Message:

Because programming is fun. After [32915], _.find() will return undefined if an empty array is passed - in that case, the function should return true.

See #32746.

Location:
trunk/src/wp-includes/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/media-models.js

    r32915 r32916  
    901901
    902902                        if ( _.isArray( type ) ) {
    903                                 found = _.find( type, function (t) {
     903                                found = ! type.length || _.find( type, function (t) {
    904904                                        return -1 !== mime.indexOf( t );
    905905                                } );
  • trunk/src/wp-includes/js/media/models/attachments.js

    r32915 r32916  
    497497
    498498                        if ( _.isArray( type ) ) {
    499                                 found = _.find( type, function (t) {
     499                                found = ! type.length || _.find( type, function (t) {
    500500                                        return -1 !== mime.indexOf( t );
    501501                                } );
Note: See TracChangeset for help on using the changeset viewer.