|
10 | 10 | # import "SentryEvent+Private.h" |
11 | 11 | # import "SentryFileManager.h" |
12 | 12 | # import "SentryHub+Private.h" |
| 13 | +# import "SentryInternalDefines.h" |
13 | 14 | # import "SentryLogC.h" |
14 | 15 | # import "SentryOptions.h" |
15 | 16 | # import "SentryRateLimits.h" |
@@ -215,10 +216,25 @@ - (void)resumePreviousSessionReplay:(SentryEvent *)event |
215 | 216 | return; |
216 | 217 | } |
217 | 218 |
|
218 | | - SentryId *replayId = jsonObject[@"replayId"] |
219 | | - ? [[SentryId alloc] initWithUUIDString:jsonObject[@"replayId"]] |
220 | | - : [[SentryId alloc] init]; |
221 | | - NSURL *lastReplayURL = [dir URLByAppendingPathComponent:jsonObject[@"path"]]; |
| 219 | + SentryId *replayId; |
| 220 | + if (jsonObject[@"replayId"] && [jsonObject[@"replayId"] isKindOfClass:NSString.class]) { |
| 221 | + replayId = [[SentryId alloc] |
| 222 | + initWithUUIDString:SENTRY_UNWRAP_NULLABLE(NSString, jsonObject[@"replayId"])]; |
| 223 | + } else { |
| 224 | + replayId = [[SentryId alloc] init]; |
| 225 | + } |
| 226 | + if (!jsonObject[@"path"] || ![jsonObject[@"path"] isKindOfClass:NSString.class]) { |
| 227 | + SENTRY_LOG_ERROR(@"[Session Replay] Failed to read path from last replay"); |
| 228 | + return; |
| 229 | + } |
| 230 | + NSURL *_Nullable nullableUrl = |
| 231 | + [dir URLByAppendingPathComponent:SENTRY_UNWRAP_NULLABLE(NSString, jsonObject[@"path"])]; |
| 232 | + if (!nullableUrl) { |
| 233 | + SENTRY_LOG_ERROR( |
| 234 | + @"[Session Replay] Failed to create URL with path: %@", jsonObject[@"path"]); |
| 235 | + return; |
| 236 | + } |
| 237 | + NSURL *_Nonnull lastReplayURL = SENTRY_UNWRAP_NULLABLE(NSURL, nullableUrl); |
222 | 238 |
|
223 | 239 | SentryCrashReplay crashInfo = { 0 }; |
224 | 240 | bool hasCrashInfo = sentrySessionReplaySync_readInfo(&crashInfo, |
|
0 commit comments