Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit d28e193

Browse files
committed
[firebase-crashlytics] Fixes exception when trying to format crash reason when the crash has no context
1 parent 5814e2a commit d28e193

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

packages/firebase_crashlytics/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.0+2
2+
3+
* [iOS] Fixes crash when trying to report a crash without any context
4+
15
## 0.1.0+1
26

37
* Added additional exception information from the Flutter framework to the reports.

packages/firebase_crashlytics/ios/Classes/FirebaseCrashlyticsPlugin.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,16 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
7676
for (NSDictionary *errorElement in errorElements) {
7777
[frames addObject:[self generateFrame:errorElement]];
7878
}
79+
80+
NSString *context = call.arguments[@"context"];
81+
NSString *reason;
82+
if (context != nil) {
83+
reason = [NSString stringWithFormat:@"thrown %@", context];
84+
}
85+
7986
[[Crashlytics sharedInstance]
8087
recordCustomExceptionName:call.arguments[@"exception"]
81-
reason:[NSString
82-
stringWithFormat:@"thrown %s", call.arguments[@"context"]]
88+
reason:reason
8389
frameArray:frames];
8490
result(@"Error reported to Crashlytics.");
8591
} else if ([@"Crashlytics#isDebuggable" isEqualToString:call.method]) {

packages/firebase_crashlytics/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: firebase_crashlytics
22
description:
33
Flutter plugin for Firebase Crashlytics. It reports uncaught errors to the
44
Firebase console.
5-
version: 0.1.0+1
5+
version: 0.1.0+2
66
author: Flutter Team <[email protected]>
77
homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_crashlytics
88

0 commit comments

Comments
 (0)