Skip to content

Commit

Permalink
Prevent undefined error
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMStraub committed Jul 7, 2024
1 parent e1e04a1 commit a97ce31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,11 @@ export function isDateBetweenYears(date, yearMin, yearMax) {
const RANGE_BEFORE = 50
const RANGE_AFTER = 50

if (dateIsEmpty(date) || date.modifier === MOD_TEXTONLY) {
if (
date === undefined ||
dateIsEmpty(date) ||
date.modifier === MOD_TEXTONLY
) {
return false
}

Expand Down
2 changes: 1 addition & 1 deletion src/views/GrampsjsViewMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export class GrampsjsViewMap extends GrampsjsView {
const yearMin = this._year - this._yearSpan
const yearMax = this._year + this._yearSpan
return placeEvents.some(event =>
isDateBetweenYears(event.date, yearMin, yearMax)
isDateBetweenYears(event?.date, yearMin, yearMax)
)
}
return true
Expand Down

0 comments on commit a97ce31

Please sign in to comment.