DEtect undef values in defaults list

This commit is contained in:
Chris 2020-05-24 17:48:19 +01:00
parent 251e217a0c
commit 2bcc883280

View File

@ -729,7 +729,14 @@ sub build_optionlist {
$default = [ $default ] unless($default && ref($default) eq "ARRAY"); $default = [ $default ] unless($default && ref($default) eq "ARRAY");
# Convert default to a hash for faster lookup # Convert default to a hash for faster lookup
my %selected = map { $_ => 1 } @{$default}; my %selected = ();
foreach my $val (@{$default}) {
if(!defined($val)) {
carp "Undefined value in default list.";
next;
}
$selected{$val} = 1;
}
# Now build up the option string # Now build up the option string
my $optstr = ""; my $optstr = "";