From 979f5e2b442701d7a95f944aeb9192caf46a1a41 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 19 Dec 2024 13:10:18 +0200 Subject: [PATCH 1/2] Check if clipPath is empty before removing last element --- Sources/Swift/Tools/SentryViewPhotographer.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/Swift/Tools/SentryViewPhotographer.swift b/Sources/Swift/Tools/SentryViewPhotographer.swift index 33d22c15e8..d687f98a48 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) From 5d3eb3bca98eed0faefa4cbeeb5c5123cfe964ad Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 19 Dec 2024 13:39:36 +0200 Subject: [PATCH 2/2] Updates changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94661dc043..2c7932596d 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