Skip to content

Commit dd1f7d2

Browse files
authored
LoadImageListIntegration won't throw bad state if there is no exceptions in the event (#1347)
1 parent 68677de commit dd1f7d2

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Fixes
6+
7+
- LoadImageListIntegration won't throw bad state if there is no exceptions in the event ([#1347](https://github.com/getsentry/sentry-dart/pull/1347))
8+
39
## 7.1.0
410

511
### Features

flutter/lib/src/integrations/load_image_list_integration.dart

+9-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@ class LoadImageListIntegration extends Integration<SentryFlutterOptions> {
2222

2323
extension _NeedsSymbolication on SentryEvent {
2424
bool needsSymbolication() {
25-
if (this is SentryTransaction) return false;
25+
if (this is SentryTransaction) {
26+
return false;
27+
}
28+
if (exceptions?.isNotEmpty == false) {
29+
return false;
30+
}
2631
final frames = exceptions?.first.stackTrace?.frames;
27-
if (frames == null) return false;
32+
if (frames == null) {
33+
return false;
34+
}
2835
return frames.any((frame) => 'native' == frame.platform);
2936
}
3037
}

flutter/test/integrations/load_image_list_test.dart

+20
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,26 @@ void main() {
154154
expect('e77c5713-5311-28c2-ecf0-eb73fc39f450', image.debugId);
155155
expect('test', image.debugFile);
156156
});
157+
158+
test('Native layer is not called as there is no exceptions',
159+
() async {
160+
var called = false;
161+
162+
final sut = fixture.getSut();
163+
fixture.channel
164+
.setMockMethodCallHandler((MethodCall methodCall) async {
165+
called = true;
166+
return imageList;
167+
});
168+
169+
sut.call(fixture.hub, fixture.options);
170+
171+
expect(fixture.options.eventProcessors.length, 1);
172+
173+
await fixture.hub.captureMessage('error');
174+
175+
expect(called, false);
176+
});
157177
});
158178
}
159179
});

0 commit comments

Comments
 (0)