Skip to content

Commit 07d7e83

Browse files
authored
fix: Add null-handling for timestamp in breadcrumb serialization (#5802)
1 parent be6a4ee commit 07d7e83

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/Sentry/SentryBreadcrumb.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#import "SentryBreadcrumb.h"
22
#import "SentryBreadcrumb+Private.h"
33
#import "SentryDateUtils.h"
4+
#import "SentryInternalDefines.h"
45
#import "SentryLevelMapper.h"
56
#import "SentryNSDictionarySanitize.h"
67
#import "SentrySwift.h"
@@ -59,7 +60,11 @@ - (instancetype)init
5960
NSMutableDictionary *serializedData = [NSMutableDictionary new];
6061

6162
[serializedData setValue:nameForSentryLevel(self.level) forKey:@"level"];
62-
[serializedData setValue:sentry_toIso8601String(self.timestamp) forKey:@"timestamp"];
63+
if (self.timestamp != nil) {
64+
[serializedData
65+
setValue:sentry_toIso8601String(SENTRY_UNWRAP_NULLABLE(NSDate, self.timestamp))
66+
forKey:@"timestamp"];
67+
}
6368
[serializedData setValue:self.category forKey:@"category"];
6469
[serializedData setValue:self.type forKey:@"type"];
6570
[serializedData setValue:self.origin forKey:@"origin"];

0 commit comments

Comments
 (0)