Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid crash reporting OOMs if nil provided as codeBundleId #784

Merged
merged 1 commit into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Bugsnag/BSGOutOfMemoryWatchdog.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#import "Private.h"
#import "BugsnagErrorTypes.h"
#import "BSG_RFC3339DateTool.h"
#import "BugsnagCollections.h"

@interface BSGOutOfMemoryWatchdog ()
@property(nonatomic, getter=isWatching) BOOL watching;
Expand Down Expand Up @@ -167,7 +168,7 @@ - (void)handleUpdateSession:(NSNotification *)note {

- (void)setCodeBundleId:(NSString *)codeBundleId {
_codeBundleId = codeBundleId;
self.cachedFileInfo[@"app"][@"codeBundleId"] = codeBundleId;
BSGDictInsertIfNotNil(self.cachedFileInfo[@"app"], codeBundleId, @"codeBundleId");

if ([self isWatching]) {
[self writeSentinelFile];
Expand Down Expand Up @@ -258,7 +259,7 @@ - (NSMutableDictionary *)generateCacheInfoWithConfig:(BugsnagConfiguration *)con
app[@"version"] = systemInfo[@BSG_KSSystemField_BundleShortVersion] ?: @"";
app[@"bundleVersion"] = systemInfo[@BSG_KSSystemField_BundleVersion] ?: @"";
// 'codeBundleId' only (optionally) exists for React Native clients and defaults otherwise to nil
app[@"codeBundleId"] = self.codeBundleId;
BSGDictInsertIfNotNil(app, self.codeBundleId, @"codeBundleId");
#if BSGOOMAvailable
UIApplicationState state = [BSG_KSSystemInfo currentAppState];
app[@"inForeground"] = @([BSG_KSSystemInfo isInForeground:state]);
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

## TBD

### Bug fixes

* Avoid crash reporting OOMs if nil provided as codeBundleId
[#784](https://github.com/bugsnag/bugsnag-cocoa/pull/784)

## 6.1.3 (2020-08-17)

### Bug fixes
Expand Down