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

Props chandrapatel.
Fixes #39511.

Built from https://develop.svn.wordpress.org/trunk@40050


git-svn-id: http://core.svn.wordpress.org/trunk@39987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2017-02-08 19:17:43 +00:00
parent 71fb840a24
commit 907e8cbd66
3 changed files with 7 additions and 5 deletions

View File

@ -7724,9 +7724,11 @@ Toolbar = View.extend({
disabled = false;
// Prevent insertion of attachments if any of them are still uploading
disabled = _.some( selection.models, function( attachment ) {
return attachment.get('uploading') === true;
});
if ( selection && selection.models ) {
disabled = _.some( selection.models, function( attachment ) {
return attachment.get('uploading') === true;
});
}
if ( requires.selection && selection && ! selection.length ) {
disabled = true;

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-alpha-40049';
$wp_version = '4.8-alpha-40050';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.