Skip to content

Commit 0ac9467

Browse files
committed
fix error when frames is nil and add []
1 parent f847fac commit 0ac9467

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/datadog/appsec/stack_trace.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def initialize(frames)
2222
end
2323
bottom_frames = max_depth - top_frames
2424
cropped_frames = []
25-
frames.each_with_index do |frame, index|
25+
frames && frames.each_with_index do |frame, index|
2626
next if index >= top_frames && index < frames.size - bottom_frames
2727

2828
# ASCII-8BIT is encoded as byte array and backend cannot decode it properly
@@ -47,6 +47,10 @@ def each(&block)
4747
@frames.each(&block)
4848
end
4949

50+
def [](index)
51+
@frames[index]
52+
end
53+
5054
def to_msgpack(packer = nil)
5155
packer ||= MessagePack::Packer.new
5256

0 commit comments

Comments
 (0)