Media: in `wp.media.view.Toolbar.refresh()`, check for a selection before iterating over models.
Props chandrapatel. Fixes #39511. git-svn-id: https://develop.svn.wordpress.org/trunk@40050 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4004400047
commit
baff296dfa
|
@ -7724,9 +7724,11 @@ Toolbar = View.extend({
|
||||||
disabled = false;
|
disabled = false;
|
||||||
|
|
||||||
// Prevent insertion of attachments if any of them are still uploading
|
// Prevent insertion of attachments if any of them are still uploading
|
||||||
disabled = _.some( selection.models, function( attachment ) {
|
if ( selection && selection.models ) {
|
||||||
return attachment.get('uploading') === true;
|
disabled = _.some( selection.models, function( attachment ) {
|
||||||
});
|
return attachment.get('uploading') === true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if ( requires.selection && selection && ! selection.length ) {
|
if ( requires.selection && selection && ! selection.length ) {
|
||||||
disabled = true;
|
disabled = true;
|
||||||
|
|
|
@ -141,9 +141,11 @@ Toolbar = View.extend({
|
||||||
disabled = false;
|
disabled = false;
|
||||||
|
|
||||||
// Prevent insertion of attachments if any of them are still uploading
|
// Prevent insertion of attachments if any of them are still uploading
|
||||||
disabled = _.some( selection.models, function( attachment ) {
|
if ( selection && selection.models ) {
|
||||||
return attachment.get('uploading') === true;
|
disabled = _.some( selection.models, function( attachment ) {
|
||||||
});
|
return attachment.get('uploading') === true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if ( requires.selection && selection && ! selection.length ) {
|
if ( requires.selection && selection && ! selection.length ) {
|
||||||
disabled = true;
|
disabled = true;
|
||||||
|
|
Loading…
Reference in New Issue