Commit a3c710bb authored by Byron Jones's avatar Byron Jones

Bug 918647: "Use of uninitialized value" warnings when using quicksearch

r=simon, a=glob
parent 9daa109f
...@@ -196,6 +196,7 @@ sub quicksearch { ...@@ -196,6 +196,7 @@ sub quicksearch {
foreach my $qsword (@qswords) { foreach my $qsword (@qswords) {
my @or_operand = _parse_line('\|', 1, $qsword); my @or_operand = _parse_line('\|', 1, $qsword);
foreach my $term (@or_operand) { foreach my $term (@or_operand) {
next unless defined $term;
my $negate = substr($term, 0, 1) eq '-'; my $negate = substr($term, 0, 1) eq '-';
if ($negate) { if ($negate) {
$term = substr($term, 1); $term = substr($term, 1);
...@@ -262,6 +263,8 @@ sub quicksearch { ...@@ -262,6 +263,8 @@ sub quicksearch {
sub _parse_line { sub _parse_line {
my ($delim, $keep, $line) = @_; my ($delim, $keep, $line) = @_;
return () unless defined $line;
# parse_line always treats ' as a quote character, making it impossible # parse_line always treats ' as a quote character, making it impossible
# to sanely search for contractions. As this behavour isn't # to sanely search for contractions. As this behavour isn't
# configurable, we replace ' with a placeholder to hide it from the # configurable, we replace ' with a placeholder to hide it from the
...@@ -276,7 +279,7 @@ sub _parse_line { ...@@ -276,7 +279,7 @@ sub _parse_line {
my @words = parse_line($delim, $keep, $line); my @words = parse_line($delim, $keep, $line);
foreach my $word (@words) { foreach my $word (@words) {
$word =~ tr/\000/'/; $word =~ tr/\000/'/ if defined $word;
} }
return @words; return @words;
} }
...@@ -348,6 +351,7 @@ sub _handle_status_and_resolution { ...@@ -348,6 +351,7 @@ sub _handle_status_and_resolution {
sub _handle_special_first_chars { sub _handle_special_first_chars {
my ($qsword, $negate) = @_; my ($qsword, $negate) = @_;
return 0 if !defined $qsword || length($qsword) <= 1;
my $firstChar = substr($qsword, 0, 1); my $firstChar = substr($qsword, 0, 1);
my $baseWord = substr($qsword, 1); my $baseWord = substr($qsword, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment