Skip to content

Commit

Permalink
validate that attributes.navigateMapLayers is not null before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
pamelars86 committed Mar 4, 2021
1 parent bbba95b commit 4d1ca99
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/js/src/map-blocks/storymap-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,16 @@ const MapEditor = ( {
>
{ attributes.slides[ currentSlideIndex ].selectedLayers.map(
( layer ) => {
const layerOptions = attributes.navigateMapLayers.find(
( { id } ) => id === layer.id
);
// console.log(layerOptions);
if ( layerOptions ) {
return renderLayer( {
layer: layerOptions.meta,
instance: layer,
} );
if(attributes.navigateMapLayers) {
const layerOptions = attributes.navigateMapLayers.find(
( { id } ) => id === layer.id
);
if ( layerOptions ) {
return renderLayer( {
layer: layerOptions.meta,
instance: layer,
} );
}
}
}
) }
Expand Down

0 comments on commit 4d1ca99

Please sign in to comment.