Skip to content

Commit 5891298

Browse files
authored
fix(ios): disallow empty report error stack (#455)
workaround for known metrickit issue where an empty thread is marked as causing a crash diagnostic (FB18302500)
1 parent 7710b85 commit 5891298

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

platform/swift/source/reports/DiagnosticEventReporter.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,17 @@ static uint64_t count_frames(NSDictionary *rootFrame) {
128128
static uint32_t crashed_thread_index(NSArray *stacks) {
129129
for (uint32_t index = 0; index < stacks.count; index++) {
130130
if ([number_for_key(stacks[index], @"threadAttributed") boolValue]) {
131-
return index;
131+
if (count_frames(thread_root_frame(stacks[index])) > 0) {
132+
// match only if thread contains frames (FB18302500)
133+
return index;
134+
}
135+
break;
132136
}
133137
}
134138
for (uint32_t index = 0; index < stacks.count; index++) {
135139
if (count_frames(thread_root_frame(stacks[index])) > 0) {
136-
return index; // grab first thread with frames if none attributed
140+
// grab first thread with frames if none attributed or attributed to empty
141+
return index;
137142
}
138143
}
139144

0 commit comments

Comments
 (0)