Skip to content

Commit cd56975

Browse files
committed
Update
1 parent 4cb4c02 commit cd56975

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

sentry-kotlin-multiplatform/sentry_kotlin_multiplatform.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ Pod::Spec.new do |spec|
5454
}
5555
]
5656

57-
end
57+
end

sentry-kotlin-multiplatform/src/appleMain/kotlin/io/sentry/kotlin/multiplatform/SentryBridge.apple.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ public actual abstract class Context
2020
// like on JVM and Android, we may do that later on if needed.
2121
internal actual fun SentryPlatformOptions.prepareForInit() {
2222
val cocoa = this as? CocoaSentryOptions
23-
val existingBeforeSend = cocoa?.beforeSend
23+
val userDefinedBeforeSend = cocoa?.beforeSend
2424
val modifiedBeforeSend: (CocoaSentryEvent?) -> CocoaSentryEvent? = beforeSend@{ event ->
25+
// Return early if the user's beforeSend returns null
26+
if (userDefinedBeforeSend != null && userDefinedBeforeSend.invoke(event) == null) {
27+
return@beforeSend null
28+
}
2529
val cocoaName = BuildKonfig.SENTRY_COCOA_PACKAGE_NAME
2630
val cocoaVersion = BuildKonfig.SENTRY_COCOA_VERSION
2731

@@ -32,9 +36,6 @@ internal actual fun SentryPlatformOptions.prepareForInit() {
3236
sdk["packages"] = packages
3337
event?.sdk = sdk
3438

35-
if (existingBeforeSend?.invoke(event) == null) {
36-
return@beforeSend null
37-
}
3839
dropKotlinCrashEvent(event)
3940
}
4041

0 commit comments

Comments
 (0)