Skip to content

Commit

Permalink
Fix issue with note references media (fixes #413)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMStraub committed Mar 29, 2024
1 parent ce9041b commit 0e5254b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/GrampsjsMediaObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -480,7 +480,7 @@ export class GrampsjsMediaObject extends GrampsjsObject {
})
)
.flat()
.filter(obj => obj.rect.length > 0)
.filter(obj => obj.rect?.length > 0)
}

_handleSaveMap(e) {
Expand Down
4 changes: 2 additions & 2 deletions src/views/GrampsjsViewMediaLightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -256,7 +256,7 @@ export class GrampsjsViewMediaLightbox extends GrampsjsView {
})
)
.flat()
.filter(obj => obj.rect.length > 0)
.filter(obj => obj.rect?.length > 0)
}

connectedCallback() {
Expand Down

0 comments on commit 0e5254b

Please sign in to comment.