word: prevent infinite loops on invalid data
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 1 Nov 2021 23:38:57 +0000 (00:38 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 6 Dec 2021 11:07:29 +0000 (12:07 +0100)
word.plp

index d1c0241bbf93425892807bf238b1e3c14277813e..64a093fed42afa818d8185450b8815e80e82cedd 100644 (file)
--- a/word.plp
+++ b/word.plp
@@ -89,6 +89,7 @@ sub printimgs {
        say '<ul>';
        for my $row (@_) {
                my ($id, $level, $title) = split /:/, $row, 3;
+               $id or die "empty reference"; # assertion to prevent loops
                my @type;
                push @type, 'parent' if defined $table->{$id};
                push @type, 'large'  if $level =~ s/c$//;