Skip to content

Commit

Permalink
[firebase-crashlytics] Fixes exception when trying to format crash re…
Browse files Browse the repository at this point in the history
…ason when the crash has no context (firebase#1931)
  • Loading branch information
josh-burton authored and collinjackson committed Jul 30, 2019
1 parent 4870b94 commit b40e3bb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions packages/firebase_crashlytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.0+2

* [iOS] Fixes crash when trying to report a crash without any context

## 0.1.0+1

* Added additional exception information from the Flutter framework to the reports.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,16 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
for (NSDictionary *errorElement in errorElements) {
[frames addObject:[self generateFrame:errorElement]];
}
[[Crashlytics sharedInstance]
recordCustomExceptionName:call.arguments[@"exception"]
reason:[NSString
stringWithFormat:@"thrown %s", call.arguments[@"context"]]
frameArray:frames];

NSString *context = call.arguments[@"context"];
NSString *reason;
if (context != nil) {
reason = [NSString stringWithFormat:@"thrown %@", context];
}

[[Crashlytics sharedInstance] recordCustomExceptionName:call.arguments[@"exception"]
reason:reason
frameArray:frames];
result(@"Error reported to Crashlytics.");
} else if ([@"Crashlytics#isDebuggable" isEqualToString:call.method]) {
result([NSNumber numberWithBool:[Crashlytics sharedInstance].debugMode]);
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_crashlytics/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: firebase_crashlytics
description:
Flutter plugin for Firebase Crashlytics. It reports uncaught errors to the
Firebase console.
version: 0.1.0+1
version: 0.1.0+2
author: Flutter Team <[email protected]>
homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_crashlytics

Expand Down

0 comments on commit b40e3bb

Please sign in to comment.