Skip to content

Commit

Permalink
Fix: Gallery crashes on contributor roles (#19060)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta authored Dec 11, 2019
1 parent 166f4c6 commit ee3e0b2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/block-library/src/gallery/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,11 @@ class GalleryEdit extends Component {
componentDidMount() {
const { attributes, mediaUpload } = this.props;
const { images } = attributes;
if ( Platform.OS === 'web' && every( images, ( { url } ) => isBlobURL( url ) ) ) {
if (
Platform.OS === 'web' &&
images && images.length > 0 &&
every( images, ( { url } ) => isBlobURL( url ) )
) {
const filesList = map( images, ( { url } ) => getBlobByURL( url ) );
forEach( images, ( { url } ) => revokeBlobURL( url ) );
mediaUpload( {
Expand Down

0 comments on commit ee3e0b2

Please sign in to comment.