Commit 5cfce5e
fix(ios): Guard against nil NSData and pin tests to SPI import
Two fixes flagged by Warden:
1. `RNSentryInternal.envelope(fromData:)` accepted a non-optional Swift
`Data`. If the ObjC caller passed a nil `NSData*` (e.g. from a failed
base64 decode of the envelope payload), the ObjC→Swift bridge would
force-unwrap it and crash before the method body ran. Change the
parameter to `Data?` with an internal `guard let` — matches the
nil-tolerant behaviour of the deprecated
`PrivateSentrySDKOnly.envelopeWithData:`.
2. Swift Cocoa tests accessed `SentrySDK.internal.*` with plain
`import Sentry`. The `.internal` accessor is public today, but the
sub-APIs the tests touch (`options`, `appStart`, `performance`) sit
next to `@_spi(Private)`-gated siblings on the same struct. Add
`@_spi(Private) import Sentry` to `RNSentryStartTests.swift`,
`RNSentryStartFromFileTests.swift`, and `RNSentryReplayOptionsTests.swift`
so they keep compiling if the surface is ever tightened.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 7becfaa commit 5cfce5e
4 files changed
Lines changed: 10 additions & 5 deletions
File tree
- packages/core
- RNSentryCocoaTester/RNSentryCocoaTesterTests
- ios
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
| |||
0 commit comments