From d0d24cf9ec92d687e771c5b4061bb61ae5d31720 Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Mon, 17 Jun 2013 14:31:44 +0000 Subject: Check type when assigning new ID --- lib/MGA/Advisories.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm index fed9caa..cdba96f 100644 --- a/lib/MGA/Advisories.pm +++ b/lib/MGA/Advisories.pm @@ -84,8 +84,12 @@ sub assign_id { print STDERR "$bugnum already has an ID assigned: $adv->{ID}\n"; return; } - $adv->{ID} = next_id($config->{advisory_types}{$adv->{type}}{prefix}, - keys %{get_advisories_from_dir()}); + my $type = $config->{advisory_types}{$adv->{type}}{prefix}; + if (!$type) { + print STDERR "Unknow type $adv->{type}\n"; + return; + } + $adv->{ID} = next_id($type, keys %{get_advisories_from_dir()}); open(my $fh, '>>', $advfile) or die "Error opening $advfile"; print $fh "ID: $adv->{ID}\n"; close $fh; -- cgit v1.2.1