Skip to content
This repository was archived by the owner on Sep 14, 2020. It is now read-only.

Commit 84ab0de

Browse files
committed
remove unnecessary nil checks from vendored cocoa code
1 parent 593920d commit 84ab0de

2 files changed

Lines changed: 10 additions & 13 deletions

File tree

cocoa/vendor/bugsnag-cocoa/Source/BugsnagSessionTracker.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ - (void)send {
9696
}
9797
BugsnagSessionTrackingPayload *payload = [[BugsnagSessionTrackingPayload alloc] initWithSessions:sessions];
9898

99-
if (payload.sessions.count > 0 && self.config.apiKey.length > 0) {
99+
if (payload.sessions.count > 0) {
100100
[self.apiClient sendData:payload
101101
withPayload:[payload toJson]
102102
toURL:self.config.sessionURL

cocoa/vendor/bugsnag-cocoa/Source/BugsnagSink.m

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ - (void)filterReports:(NSArray *)reports
9595
}
9696
#pragma clang diagnostic pop
9797

98-
if (reportData == nil || [reportData count] <= 0) {
98+
if (reportData == nil) {
9999
if (onCompletion) {
100100
onCompletion(@[], YES, nil);
101101
}
@@ -113,20 +113,17 @@ - (void)filterReports:(NSArray *)reports
113113
// Generates the payload for notifying Bugsnag
114114
- (NSDictionary *)getBodyFromReports:(NSArray *)reports {
115115
NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
116+
BSGDictSetSafeObject(data, [Bugsnag notifier].details, BSGKeyNotifier);
117+
BSGDictSetSafeObject(data, [Bugsnag notifier].configuration.apiKey, BSGKeyApiKey);
116118

117-
if ([Bugsnag notifier].configuration.apiKey.length > 0) {
118-
BSGDictSetSafeObject(data, [Bugsnag notifier].details, BSGKeyNotifier);
119-
BSGDictSetSafeObject(data, [Bugsnag notifier].configuration.apiKey, BSGKeyApiKey);
119+
NSMutableArray *formatted =
120+
[[NSMutableArray alloc] initWithCapacity:[reports count]];
120121

121-
NSMutableArray *formatted =
122-
[[NSMutableArray alloc] initWithCapacity:[reports count]];
123-
124-
for (BugsnagCrashReport *report in reports) {
125-
BSGArrayAddSafeObject(formatted, [report toJson]);
126-
}
127-
128-
BSGDictSetSafeObject(data, formatted, BSGKeyEvents);
122+
for (BugsnagCrashReport *report in reports) {
123+
BSGArrayAddSafeObject(formatted, [report toJson]);
129124
}
125+
126+
BSGDictSetSafeObject(data, formatted, BSGKeyEvents);
130127
return data;
131128
}
132129

0 commit comments

Comments
 (0)