Skip to content

Commit

Permalink
LoadImageListIntegration won't throw bad state if there is no excepti…
Browse files Browse the repository at this point in the history
…ons in the event (#1347)
  • Loading branch information
marandaneto authored Mar 20, 2023
1 parent 68677de commit dd1f7d2
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixes

- LoadImageListIntegration won't throw bad state if there is no exceptions in the event ([#1347](https://github.com/getsentry/sentry-dart/pull/1347))

## 7.1.0

### Features
Expand Down
11 changes: 9 additions & 2 deletions flutter/lib/src/integrations/load_image_list_integration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ class LoadImageListIntegration extends Integration<SentryFlutterOptions> {

extension _NeedsSymbolication on SentryEvent {
bool needsSymbolication() {
if (this is SentryTransaction) return false;
if (this is SentryTransaction) {
return false;
}
if (exceptions?.isNotEmpty == false) {
return false;
}
final frames = exceptions?.first.stackTrace?.frames;
if (frames == null) return false;
if (frames == null) {
return false;
}
return frames.any((frame) => 'native' == frame.platform);
}
}
Expand Down
20 changes: 20 additions & 0 deletions flutter/test/integrations/load_image_list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,26 @@ void main() {
expect('e77c5713-5311-28c2-ecf0-eb73fc39f450', image.debugId);
expect('test', image.debugFile);
});

test('Native layer is not called as there is no exceptions',
() async {
var called = false;

final sut = fixture.getSut();
fixture.channel
.setMockMethodCallHandler((MethodCall methodCall) async {
called = true;
return imageList;
});

sut.call(fixture.hub, fixture.options);

expect(fixture.options.eventProcessors.length, 1);

await fixture.hub.captureMessage('error');

expect(called, false);
});
});
}
});
Expand Down

0 comments on commit dd1f7d2

Please sign in to comment.