Skip to content

Commit

Permalink
Use nil returning dig?
Browse files Browse the repository at this point in the history
  • Loading branch information
spuun committed Nov 9, 2024
1 parent 1074f29 commit 89b1a76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lavinmq/http/controller.cr
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module LavinMQ
if sort_by = params.fetch("sort", nil)
sorted_items = all_items.to_a
filtered_count = sorted_items.size
sorted_items.sort_by! { |i| i.dig(sort_by) }
sorted_items.sort_by! { |i| i.dig?(sort_by) }
sorted_items.reverse! if params["sort_reverse"]?.try { |s| !(s =~ /^false$/i) }
all_items = sorted_items.each
end
Expand Down

0 comments on commit 89b1a76

Please sign in to comment.