aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-09-23 22:34:57 +0800
committerByron Jones <bjones@mozilla.com>2013-09-23 22:34:57 +0800
commita3c710bb310bd7524ec564797e9148ddfa5b57c8 (patch)
tree543240f25cfca7a1e24539d837e360c90ddfc14b
parent9daa109fb9dd2e3d5b88ad84ae89bf2cadbb5a49 (diff)
downloadbugs-a3c710bb310bd7524ec564797e9148ddfa5b57c8.tar
bugs-a3c710bb310bd7524ec564797e9148ddfa5b57c8.tar.gz
bugs-a3c710bb310bd7524ec564797e9148ddfa5b57c8.tar.bz2
bugs-a3c710bb310bd7524ec564797e9148ddfa5b57c8.tar.xz
bugs-a3c710bb310bd7524ec564797e9148ddfa5b57c8.zip
Bug 918647: "Use of uninitialized value" warnings when using quicksearch
r=simon, a=glob
-rw-r--r--Bugzilla/Search/Quicksearch.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm
index 8bd5029a7..c07c8ba03 100644
--- a/Bugzilla/Search/Quicksearch.pm
+++ b/Bugzilla/Search/Quicksearch.pm
@@ -196,6 +196,7 @@ sub quicksearch {
foreach my $qsword (@qswords) {
my @or_operand = _parse_line('\|', 1, $qsword);
foreach my $term (@or_operand) {
+ next unless defined $term;
my $negate = substr($term, 0, 1) eq '-';
if ($negate) {
$term = substr($term, 1);
@@ -262,6 +263,8 @@ sub quicksearch {
sub _parse_line {
my ($delim, $keep, $line) = @_;
+ return () unless defined $line;
+
# parse_line always treats ' as a quote character, making it impossible
# to sanely search for contractions. As this behavour isn't
# configurable, we replace ' with a placeholder to hide it from the
@@ -276,7 +279,7 @@ sub _parse_line {
my @words = parse_line($delim, $keep, $line);
foreach my $word (@words) {
- $word =~ tr/\000/'/;
+ $word =~ tr/\000/'/ if defined $word;
}
return @words;
}
@@ -348,6 +351,7 @@ sub _handle_status_and_resolution {
sub _handle_special_first_chars {
my ($qsword, $negate) = @_;
+ return 0 if !defined $qsword || length($qsword) <= 1;
my $firstChar = substr($qsword, 0, 1);
my $baseWord = substr($qsword, 1);