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

fix: fall back to old behavior if newer value is nil in core data tracker #2865

Merged
merged 10 commits into from
Apr 24, 2023
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- Crash when serializing invalid objects (#2858)
- Possible crash in Core Data tracking (#2865)

## 8.4.0

Expand Down
5 changes: 3 additions & 2 deletions Sources/Sentry/SentryCoreDataTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ - (NSString *)descriptionForOperations:
{
NSMutableDictionary<NSString *, NSNumber *> *result = [NSMutableDictionary new];

for (NSManagedObject *item in entities) {
NSString *cl = item.entity.name;
for (id item in entities) {
armcknight marked this conversation as resolved.
Show resolved Hide resolved
// entity.name is nullable! fall back to old behavior
armcknight marked this conversation as resolved.
Show resolved Hide resolved
NSString *cl = ((NSManagedObject *)item).entity.name ?: NSStringFromClass([item class]);
armcknight marked this conversation as resolved.
Show resolved Hide resolved
NSNumber *count = result[cl];
result[cl] = [NSNumber numberWithInt:count.intValue + 1];
}
Expand Down