diff --git a/src/components/GrampsjsMediaObject.js b/src/components/GrampsjsMediaObject.js index 2bdc7d89..dbc4f3cd 100644 --- a/src/components/GrampsjsMediaObject.js +++ b/src/components/GrampsjsMediaObject.js @@ -470,7 +470,7 @@ export class GrampsjsMediaObject extends GrampsjsObject { ? getNameFromProfile(refs[index] || {}, key, this.strings) : '...' return { - rect: obj.media_list.find(mobj => mobj.ref === this.data.handle) + rect: obj?.media_list?.find(mobj => mobj.ref === this.data.handle) ?.rect, type: key, label, @@ -480,7 +480,7 @@ export class GrampsjsMediaObject extends GrampsjsObject { }) ) .flat() - .filter(obj => obj.rect.length > 0) + .filter(obj => obj.rect?.length > 0) } _handleSaveMap(e) { diff --git a/src/views/GrampsjsViewMediaLightbox.js b/src/views/GrampsjsViewMediaLightbox.js index c83a80aa..b9c8e36d 100644 --- a/src/views/GrampsjsViewMediaLightbox.js +++ b/src/views/GrampsjsViewMediaLightbox.js @@ -247,7 +247,7 @@ export class GrampsjsViewMediaLightbox extends GrampsjsView { ? getNameFromProfile(refs[index] || {}, key, this.strings) : '...' return { - rect: obj.media_list.find(mobj => mobj.ref === this._data.handle) + rect: obj?.media_list?.find(mobj => mobj.ref === this._data.handle) ?.rect, type: key, label, @@ -256,7 +256,7 @@ export class GrampsjsViewMediaLightbox extends GrampsjsView { }) ) .flat() - .filter(obj => obj.rect.length > 0) + .filter(obj => obj.rect?.length > 0) } connectedCallback() {