commit:     ca7e83173e09bafdb5763df6fd50cec499b14a85
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 19 22:27:50 2023 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Wed Apr 19 22:27:50 2023 +0000
URL:        https://gitweb.gentoo.org/proj/elections.git/commit/?id=ca7e8317

Votify: handle empty control files, e.g. empty voters

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 Votify.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Votify.pm b/Votify.pm
index 6f73954..49f21da 100644
--- a/Votify.pm
+++ b/Votify.pm
@@ -132,8 +132,9 @@ sub get_single_election_hashref {
         #print STDERR "Scan $fn\n";
         my @filenames = (sprintf("%s/%s", "$basedir/$election_name", $fn), 
sprintf("%s/%s-%s", "$basedir/$election_name", $fn, $election_name));
         #print STDERR Dumper(@filenames);
-        my $filename = abs_path(List::Util::first { $_ && -r $_ && -s $_ && ! 
-d $_ } @filenames);
-        $election{"${fn}file"} = $filename;
+        my $filename = List::Util::first { $_ && -r $_ && -s $_ && ! -d $_ } 
@filenames;
+        my $absfilename = abs_path($filename) if $filename;
+        $election{"${fn}file"} = $absfilename if $absfilename;
     };
     #print Dumper(%election);
     $election{starttime} = grabfile_int($election{'startfile'});

Reply via email to