Skip to content

Commit 753acc4

Browse files
committed
fix: null-safe span_id comparison in findSpanById
Use optional chaining (span.span_id?.toLowerCase()) to avoid crash when a span from the API has neither span_id nor event_id.
1 parent 051830a commit 753acc4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/formatters/trace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ export function findSpanById(
347347
depth: number,
348348
ancestors: TraceSpan[]
349349
): FoundSpan | null {
350-
if (span.span_id.toLowerCase() === spanId) {
350+
if (span.span_id?.toLowerCase() === spanId) {
351351
return { span, depth, ancestors };
352352
}
353353
for (const child of span.children ?? []) {

0 commit comments

Comments
 (0)