WordPress.org

Make WordPress Core

Changeset 40050


Ignore:
Timestamp:
02/08/2017 07:16:34 PM (5 years ago)
Author:
wonderboymusic
Message:

Media: in wp.media.view.Toolbar.refresh(), check for a selection before iterating over models.

Props chandrapatel.
Fixes #39511.

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

Legend:

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

    r40021 r40050  
    77257725
    77267726            // Prevent insertion of attachments if any of them are still uploading
    7727             disabled = _.some( selection.models, function( attachment ) {
    7728                 return attachment.get('uploading') === true;
    7729             });
     7727            if ( selection && selection.models ) {
     7728                disabled = _.some( selection.models, function( attachment ) {
     7729                    return attachment.get('uploading') === true;
     7730                });
     7731            }
    77307732
    77317733            if ( requires.selection && selection && ! selection.length ) {
  • trunk/src/wp-includes/js/media/views/toolbar.js

    r33337 r40050  
    142142
    143143            // Prevent insertion of attachments if any of them are still uploading
    144             disabled = _.some( selection.models, function( attachment ) {
    145                 return attachment.get('uploading') === true;
    146             });
     144            if ( selection && selection.models ) {
     145                disabled = _.some( selection.models, function( attachment ) {
     146                    return attachment.get('uploading') === true;
     147                });
     148            }
    147149
    148150            if ( requires.selection && selection && ! selection.length ) {
Note: See TracChangeset for help on using the changeset viewer.