Commit e7663671 authored by Max Kanat-Alexander's avatar Max Kanat-Alexander

"part" can return "undef" for a list, so sometimes $has_deps or $no_deps

in Bugzilla::Object::_sort_by_deps were undef. https://bugzilla.mozilla.org/show_bug.cgi?id=567303
parent 2d57ca91
...@@ -525,13 +525,13 @@ sub _sort_by_dep { ...@@ -525,13 +525,13 @@ sub _sort_by_dep {
# For fields with no dependencies, we sort them alphabetically, # For fields with no dependencies, we sort them alphabetically,
# so that validation always happens in a consistent order. # so that validation always happens in a consistent order.
# Fields with no dependencies come at the start of the list. # Fields with no dependencies come at the start of the list.
my @result = sort @$no_deps; my @result = sort @{ $no_deps || [] };
# Fields with dependencies all go at the end of the list, and if # Fields with dependencies all go at the end of the list, and if
# they have dependencies on *each other*, then they have to be # they have dependencies on *each other*, then they have to be
# sorted properly. We go through $has_deps in sorted order to be # sorted properly. We go through $has_deps in sorted order to be
# sure that fields always validate in a consistent order. # sure that fields always validate in a consistent order.
foreach my $field (sort @$has_deps) { foreach my $field (sort @{ $has_deps || [] }) {
if (!grep { $_ eq $field } @result) { if (!grep { $_ eq $field } @result) {
_insert_dep_field($field, $has_deps, $dependencies, \@result); _insert_dep_field($field, $has_deps, $dependencies, \@result);
} }
......
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