Fix hexdump color crash

This commit is contained in:
ChillerDragon 2022-11-16 14:13:02 +01:00
parent 7697e5f451
commit 804b3c87a2

View file

@ -66,6 +66,8 @@ def hexdump_lines(data, width = 2, notes = [], opts = {})
# puts "from: #{from} to: #{to}"
(from..to).each do |i|
next if byte_group[i].nil?
byte_group[i] = byte_group[i].send(color)
end
end
@ -113,4 +115,9 @@ def todo_make_this_a_unit_test
hexdump_lines("\x01\x41\x02\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\xef", 40, notes, long_legend: true).each do |l|
puts l
end
# should not crash when annotating bytes out of range
hexdump_lines("\x01\x41", 40, notes, long_legend: false).each do |l|
puts l
end
end