dont leak weaken
[catagits/Reaction.git] / lib / Reaction / UI / ViewPort.pm
index 5e6f39c..c5b1a58 100644 (file)
@@ -121,14 +121,12 @@ sub event_id_for {
 
 sub sort_by_spec {
   my ($self, $spec, $items) = @_;
-  return $items if not defined $spec;
+  return [sort @$items] unless $spec;
 
   my @order;
   if (ref $spec eq 'ARRAY') {
     @order = @$spec;
-  }
-  elsif (not ref $spec) {
-    return $items unless length $spec;
+  } elsif (not ref $spec) {
     @order = split /\s+/, $spec;
   }