Skip to content

Commit 7b64af5

Browse files
committed
on pause, checking if the last segment exists
1 parent ffffe97 commit 7b64af5

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

ios/RNRecorderManager.m

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ - (UIView *)view
5252

5353
SCRecordSessionSegment* ls = [_recorderView lastSegment];
5454

55-
NSString *thumbnail = [_recorderView saveImage:ls.thumbnail];
56-
NSString *url = [ls.url relativeString];
57-
float duration = CMTimeGetSeconds(ls.duration);
58-
59-
NSDictionary *props = @{@"url": url, @"thumbnail":thumbnail, @"duration":@(duration)};
60-
callback(@[props]);
55+
if (ls != nil) {
56+
NSString *thumbnail = [_recorderView saveImage:ls.thumbnail];
57+
NSString *url = [ls.url relativeString];
58+
float duration = CMTimeGetSeconds(ls.duration);
59+
60+
NSDictionary *props = @{@"url": url, @"thumbnail":thumbnail, @"duration":@(duration)};
61+
callback(@[props]);
62+
}
6163

6264
}];
6365
}

0 commit comments

Comments
 (0)