From 84f3eaf41c30126ef87506f56ef9c1e5335d4864 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sun, 3 Aug 2014 18:12:25 +0100 Subject: Fix perl warning when invalid SRPM name is found. --- lib/MGA/Advisories.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm index 4343d47..48038af 100644 --- a/lib/MGA/Advisories.pm +++ b/lib/MGA/Advisories.pm @@ -174,11 +174,14 @@ sub sort_advisories { push @{$advdb->{by_rel}{$rel}}, $adv; foreach my $media (keys %{$advdb->{advisories}{$adv}{src}{$rel}}) { push @{$advdb->{by_media}{$media}}, $adv; - my %pkgs; foreach my $srpm (@{$advdb->{advisories}{$adv}{src}{$rel}{$media}}) { my $pkgname = $tools{pkgname}->($srpm); - push @{$advdb->{by_src}{$pkgname}}, $adv - unless grep { $_ eq $adv } @{$advdb->{by_src}{$pkgname}}; + if ($pkgname) { + push @{$advdb->{by_src}{$pkgname}}, $adv + unless grep { $_ eq $adv } @{$advdb->{by_src}{$pkgname}}; + } else { + print STDERR "Warning: Invalid SRPM '$srpm' for advisory '$adv'\n"; + } } } } -- cgit v1.2.1