Skip to content

Commit 00ea226

Browse files
authored
Merge pull request #20454 from adfoster-r7/fix-show-options-crash
Fix show options crash
2 parents 2553fed + c5e342d commit 00ea226

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/msf/base/serializer/readable_text.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,13 @@ def self.dump_options(mod, indent = '', missing = false, advanced: false, evasio
581581

582582
option_tables = []
583583

584-
options_grouped_by_conditions.sort.each do |conditions, options|
584+
sort_by_empty_then_lexicographical = proc do |(conditions_a, _options_a), (conditions_b, _options_b)|
585+
next -1 if conditions_a.empty?
586+
next 1 if conditions_b.empty?
587+
conditions_a.to_s <=> conditions_b.to_s
588+
end
589+
590+
options_grouped_by_conditions.sort(&sort_by_empty_then_lexicographical).each do |conditions, options|
585591
tbl = options_table(missing, mod, options, indent)
586592

587593
next if tbl.rows.empty?

0 commit comments

Comments
 (0)