Commit 3e06a51f authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 600598: "Can't call method "bug_list" on unblessed reference" error thrown…

Bug 600598: "Can't call method "bug_list" on unblessed reference" error thrown when editing a bug which is in the BUGLIST cookie but not in a recent saved search, with action="next_bug" r/a=mkanat
parent 7995b869
...@@ -90,6 +90,18 @@ sub check { ...@@ -90,6 +90,18 @@ sub check {
return $search; return $search;
} }
sub new_from_cookie {
my ($invocant, $bug_ids) = @_;
my $class = ref($invocant) || $invocant;
my $search = { id => 'cookie',
user_id => Bugzilla->user->id,
bug_list => join(',', @$bug_ids) };
bless $search, $class;
return $search;
}
#################### ####################
# Simple Accessors # # Simple Accessors #
#################### ####################
......
...@@ -425,7 +425,8 @@ sub recent_search_for { ...@@ -425,7 +425,8 @@ sub recent_search_for {
if (my $list = $cgi->cookie('BUGLIST')) { if (my $list = $cgi->cookie('BUGLIST')) {
my @bug_ids = split(':', $list); my @bug_ids = split(':', $list);
if (grep { $_ == $bug->id } @bug_ids) { if (grep { $_ == $bug->id } @bug_ids) {
return { id => 'cookie', bug_list => \@bug_ids }; my $search = Bugzilla::Search::Recent->new_from_cookie(\@bug_ids);
return $search;
} }
} }
......
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