diff --git a/CHANGELOG.md b/CHANGELOG.md index 94661dc0431..2c7932596db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - `SentrySdkInfo.packages` should be an array (#4626) - Use the same SdkInfo for envelope header and event (#4629) +- Fixes Session replay screenshot provider crash (#4649) ### Internal diff --git a/Sources/Swift/Tools/SentryViewPhotographer.swift b/Sources/Swift/Tools/SentryViewPhotographer.swift index 33d22c15e8a..d687f98a48f 100644 --- a/Sources/Swift/Tools/SentryViewPhotographer.swift +++ b/Sources/Swift/Tools/SentryViewPhotographer.swift @@ -82,7 +82,9 @@ class SentryViewPhotographer: NSObject, SentryViewScreenshotProvider { clipPaths: clipPaths, clipOutPath: clipOutPath) case .clipEnd: - clipPaths.removeLast() + if !clipPaths.isEmpty { + clipPaths.removeLast() + } self.updateClipping(for: context.cgContext, clipPaths: clipPaths, clipOutPath: clipOutPath)