Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/sentry/issues/auto_source_code_config/stacktraces.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def get_frames_to_process(data: NodeData | dict[str, Any], platform: str) -> lis
for stacktrace in stacktraces:
frames = stacktrace["frames"] or []
for frame in frames:
if frame is None:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally get_stacktraces would not allow returning invalid date or even get_path to do a better job of filtering out Nones.

continue

if platform_config.creates_in_app_stack_trace_rules():
frames_to_process.append(frame)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def _stacktrace(frames: list[dict[str, Any]]) -> dict[str, Any]:
return {"stacktrace": {"frames": frames}}


BASIC_FRAME = {"in_app": True, "filename": "foo"}


@pytest.mark.parametrize(
"frames, platform, expected",
[
Expand Down Expand Up @@ -83,7 +86,8 @@ def test_get_frames_to_process(
(None, []),
([None], []),
([], []),
([{"in_app": True}], []),
([{"in_app": True}], []), # Both in_app and filename are required
([BASIC_FRAME, None], [BASIC_FRAME]), # Handle intermixing of None and dicts
],
)
def test_with_invalid_frames(frames: list[dict[str, Any]], expected: list[str]) -> None:
Expand Down
Loading