Skip to content

Commit

Permalink
Handle events with no type()
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Jun 21, 2024
1 parent bfff44b commit 7c6a99d
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions gedcom
Original file line number Diff line number Diff line change
Expand Up @@ -2396,6 +2396,14 @@ sub print_person

my @events = $person->event();

if(scalar(@events) == 2) {
my $event = $events[1];
if(!ref($event)) {
red_warning({ person => $person, warning => "Event record is just description ($event), information has been lost" });
pop @events;
}
}

if(scalar(@events) > 1) {
# my $all_have_dates = 1;
# foreach my $event(@events) {
Expand Down Expand Up @@ -2433,11 +2441,11 @@ sub print_person
my $event = $person->event();
if(!ref($event)) {
my $e = $person->tag_record('EVEN');
if(ref($e) eq 'Gedcom::Record') {
if($e->isa('Gedcom::Record')) {
$event = $e;
}
}
if((ref($event) eq 'Gedcom::Record') &&
if($event->can('type') && defined($event->type()) &&
($event->type() eq 'Custom Marriage')) {
# FindMyPast
$marriage = $event;
Expand Down Expand Up @@ -5654,8 +5662,7 @@ sub print_person
my $funeral;

if((scalar(@events) == 2) &&
(ref($events[0]) eq 'Gedcom::Record') &&
(ref($events[1]) eq 'Gedcom::Record') &&
$events[0]->can('type') && $events[1]->can('type') &&
((($events[0]->type() eq 'Arrival') && ($events[1]->type() eq 'Departure')) ||
(($events[1]->type() eq 'Arrival') && ($events[0]->type() eq 'Departure')))) {
if($phrase->rtrim()->length() > 0) {
Expand Down Expand Up @@ -12202,6 +12209,9 @@ sub get_year_from_date($)
return $year;
}
complain("Can't parse string '$string'");
if($string =~ /(\d{4})/) {
return $1;
}
}

# https://www.gnu.org/software/gettext/manual/html_node/Locale-Environment-Variables.html
Expand Down

0 comments on commit 7c6a99d

Please sign in to comment.