diff options
author | Damien Nozay <damien.nozay@gmail.com> | 2014-01-13 17:26:28 +0100 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2014-01-13 17:26:28 +0100 |
commit | 9a5f59187a2be3f744efc5e4e33e6bd956d9aa89 (patch) | |
tree | 4aa60717bec91692dbd8b3aa988cb0563cdc67fa /Bugzilla | |
parent | cf84d586a8927662fcf7d7dcd50add4d2b801723 (diff) | |
download | bugzilla-9a5f59187a2be3f744efc5e4e33e6bd956d9aa89.tar.gz bugzilla-9a5f59187a2be3f744efc5e4e33e6bd956d9aa89.tar.xz |
Bug 904467 - error when %recipients is empty (e.g. after bugmail_recipients empties it)
r/a=glob
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/BugMail.pm | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index 6c7be5e12..48222fbf7 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -186,21 +186,24 @@ sub Send { { bug => $bug, recipients => \%recipients, users => \%user_cache, diffs => \@diffs }); - # Find all those user-watching anyone on the current list, who is not - # on it already themselves. - my $involved = join(",", keys %recipients); - - my $userwatchers = - $dbh->selectall_arrayref("SELECT watcher, watched FROM watch - WHERE watched IN ($involved)"); - - # Mark these people as having the role of the person they are watching - foreach my $watch (@$userwatchers) { - while (my ($role, $bits) = each %{$recipients{$watch->[1]}}) { - $recipients{$watch->[0]}->{$role} |= BIT_WATCHING - if $bits & BIT_DIRECT; + # We should not assume %recipients to have any entries. + if (scalar keys %recipients) { + # Find all those user-watching anyone on the current list, who is not + # on it already themselves. + my $involved = join(",", keys %recipients); + + my $userwatchers = + $dbh->selectall_arrayref("SELECT watcher, watched FROM watch + WHERE watched IN ($involved)"); + + # Mark these people as having the role of the person they are watching + foreach my $watch (@$userwatchers) { + while (my ($role, $bits) = each %{$recipients{$watch->[1]}}) { + $recipients{$watch->[0]}->{$role} |= BIT_WATCHING + if $bits & BIT_DIRECT; + } + push(@{$watching{$watch->[0]}}, $watch->[1]); } - push(@{$watching{$watch->[0]}}, $watch->[1]); } # Global watcher |