From d98d3bd9f5a7f0115bc5e25f083e7439e766e0b7 Mon Sep 17 00:00:00 2001 From: Nigel Horne Date: Sat, 16 Nov 2024 14:30:55 -0500 Subject: [PATCH] Fix uninitialized value --- gedcom | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/gedcom b/gedcom index e62e67a..105c4c0 100755 --- a/gedcom +++ b/gedcom @@ -4200,10 +4200,15 @@ sub print_person $phrase->append(scalar(@spouses) . i18n(' times')); } - # Sort the order of the marriages by date + # Sort the marriages by date my $all_marriages_have_date = 1; foreach my $spouse(@spouses) { - if(!date_to_datetime(dateofmarriage($spouse))) { + if(my $dom = dateofmarriage($spouse)) { + if(!date_to_datetime($dom)) { + $all_marriages_have_date = 0; + last; + } + } else { $all_marriages_have_date = 0; last; } @@ -8444,11 +8449,13 @@ sub all_records_have_date # Check if the date is valid and matches required format if((!defined $date) || ($date !~ /^\d/) || ($date =~ /[a-z]$/i) || ($date =~ /[\/\-]/) || ($date =~ / to /) || !date_parser_cached(date => $date)) { - # Log a warning if date is invalid - complain({ - person => $person, - warning => "Record has an invalid date of $date" - }); + if(defined($date)) { + # Log a warning if date is invalid + complain({ + person => $person, + warning => "Record has an invalid date of $date" + }); + } return 0; } }