From 9c934b9279b0f2a9cc1430723512fadb5ae97a9b Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Tue, 8 Dec 2015 15:35:30 +0100 Subject: [PATCH] + Fix #237 --- centreon-plugins/centreon/plugins/alternative/Getopt.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/centreon-plugins/centreon/plugins/alternative/Getopt.pm b/centreon-plugins/centreon/plugins/alternative/Getopt.pm index ceb1f595b..62ede9f01 100644 --- a/centreon-plugins/centreon/plugins/alternative/Getopt.pm +++ b/centreon-plugins/centreon/plugins/alternative/Getopt.pm @@ -58,7 +58,7 @@ sub GetOptions { my $search_str = ',' . join(',', keys %opts) . ','; my $num_args = scalar(@ARGV); for (my $i = 0; $i < $num_args;) { - if ($ARGV[$i] =~ /^--(.*?)(?:=|$)(.*)/) { + if (defined($ARGV[$i]) && $ARGV[$i] =~ /^--(.*?)(?:=|$)(.*)/) { my ($option, $value) = ($1, $2); # find type of option @@ -89,7 +89,7 @@ sub GetOptions { splice @ARGV, $i, 1; $num_args--; } else { - warn "argument $ARGV[$i] alone" if ($warn_message == 1 && $i != 0); + warn "argument $ARGV[$i] alone" if ($warn_message == 1 && $i != 0 && defined($ARGV[$i])); $i++; } }