Skip to content

Commit

Permalink
Make sure these are array refs
Browse files Browse the repository at this point in the history
  • Loading branch information
mickenordin committed Mar 1, 2017
1 parent 2b14819 commit a9a1897
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/Thruk/Controller/api_conf.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,22 @@ sub contacts {
my $state_select = $params->{'states'};
my $type_select = $params->{'types'};

unless ( ref $params->{'groups'} eq 'ARRAY' ) {
my @arrr = ();
$arrr[0] = $params->{'groups'};
$group_select = \@arrr;
}
unless ( ref $params->{'states'} eq 'ARRAY' ) {
my @arrrr = ();
$arrrr[0] = $params->{'states'};
$state_select = \@arrrr;
}
unless ( ref $params->{'types'} eq 'ARRAY' ) {
my @arrrrr = ();
$arrrrr[0] = $params->{'types'};
$type_select = \@arrrrr;
}

my @temp_arr;
for my $hashref ( values $c->{'db'}->get_contacts() ) {
push @temp_arr, $hashref->{'name'};
Expand Down

0 comments on commit a9a1897

Please sign in to comment.