Skip to content
/ loom Public

Commit ddb6c10

Browse files
ghuntleyclaude
andcommitted
Fix null checks in crash components
- Add null checks for breadcrumbs, active_flags, and stacktrace in IssueDetail.svelte before accessing .length - Use nullish coalescing for frames in Stacktrace.svelte to prevent "Cannot read properties of undefined (reading 'length')" errors Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c091245 commit ddb6c10

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

web/loom-web/src/lib/components/crash/IssueDetail.svelte

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,13 @@
152152
</div>
153153
</section>
154154

155-
<section class="issue-section">
156-
<Stacktrace stacktrace={issue.latest_event.stacktrace} />
157-
</section>
155+
{#if issue.latest_event.stacktrace}
156+
<section class="issue-section">
157+
<Stacktrace stacktrace={issue.latest_event.stacktrace} />
158+
</section>
159+
{/if}
158160

159-
{#if issue.latest_event.breadcrumbs.length > 0}
161+
{#if issue.latest_event.breadcrumbs && issue.latest_event.breadcrumbs.length > 0}
160162
<section class="issue-section">
161163
<Breadcrumbs breadcrumbs={issue.latest_event.breadcrumbs} />
162164
</section>
@@ -167,7 +169,7 @@
167169
<UserContext user={issue.latest_event.user_context} />
168170
{/if}
169171

170-
{#if Object.keys(issue.latest_event.active_flags).length > 0}
172+
{#if issue.latest_event.active_flags && Object.keys(issue.latest_event.active_flags).length > 0}
171173
<ActiveFlags flags={issue.latest_event.active_flags} />
172174
{/if}
173175
</div>

web/loom-web/src/lib/components/crash/Stacktrace.svelte

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
let expandedFrames = $state<Set<number>>(new Set());
3030
let showAllFrames = $state(false);
3131
32-
const inAppFrames = $derived(stacktrace.frames.filter((f) => f.in_app));
33-
const displayedFrames = $derived(showAllFrames ? stacktrace.frames : inAppFrames);
32+
const frames = $derived(stacktrace?.frames ?? []);
33+
const inAppFrames = $derived(frames.filter((f) => f.in_app));
34+
const displayedFrames = $derived(showAllFrames ? frames : inAppFrames);
3435
3536
function toggleFrame(index: number) {
3637
const newSet = new Set(expandedFrames);
@@ -57,7 +58,7 @@
5758
<h3 class="stacktrace-title">{title}</h3>
5859
<div class="stacktrace-controls">
5960
<span class="frame-count">
60-
{displayedFrames.length} of {stacktrace.frames.length} frames
61+
{displayedFrames.length} of {frames.length} frames
6162
</span>
6263
<button class="control-btn" onclick={() => (showAllFrames = !showAllFrames)}>
6364
{showAllFrames ? 'App only' : 'All frames'}

0 commit comments

Comments
 (0)