summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-07-26 17:51:41 +0200
committerlpsolit%gmail.com <>2007-07-26 17:51:41 +0200
commitf8b8880a69966779fb2f458d57f1f99343676117 (patch)
tree3f6dc6e484030627725dd4861809453cb6527fea /Bugzilla/User.pm
parent8ce61a1c54c91ef3977f09c8896bb2cd20490989 (diff)
downloadbugzilla-f8b8880a69966779fb2f458d57f1f99343676117.tar.gz
bugzilla-f8b8880a69966779fb2f458d57f1f99343676117.tar.xz
Bug 377913: Crash when setting a requestee for a deleted flag (race condition) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wicked a=LpSolit
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r--Bugzilla/User.pm30
1 files changed, 20 insertions, 10 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 6019a78df..080a98abb 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -1169,16 +1169,26 @@ sub match_field {
# The field is a requestee field; in order for its name
# to show up correctly on the confirmation page, we need
# to find out the name of its flag type.
- if ($field_name =~ /^requestee-(\d+)$/) {
- require Bugzilla::Flag;
- my $flag = new Bugzilla::Flag($1);
- $expanded_fields->{$field_name}->{'flag_type'} =
- $flag->type;
- }
- elsif ($field_name =~ /^requestee_type-(\d+)$/) {
- require Bugzilla::FlagType;
- $expanded_fields->{$field_name}->{'flag_type'} =
- new Bugzilla::FlagType($1);
+ if ($field_name =~ /^requestee(_type)?-(\d+)$/) {
+ my $flag_type;
+ if ($1) {
+ require Bugzilla::FlagType;
+ $flag_type = new Bugzilla::FlagType($2);
+ }
+ else {
+ require Bugzilla::Flag;
+ my $flag = new Bugzilla::Flag($2);
+ $flag_type = $flag->type if $flag;
+ }
+ if ($flag_type) {
+ $expanded_fields->{$field_name}->{'flag_type'} = $flag_type;
+ }
+ else {
+ # No need to look for a valid requestee if the flag(type)
+ # has been deleted (may occur in race conditions).
+ delete $expanded_fields->{$field_name};
+ $cgi->delete($field_name);
+ }
}
}
}