Skip to content

Commit f9138e3

Browse files
committed
fix: crash on errors when saving workout sample
1 parent 4feefde commit f9138e3

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

.changeset/brown-nights-play.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@kingstinct/react-native-healthkit": patch
3+
---
4+
5+
fix: crash on errors when saving workout sample
6+

bun.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
},
8484
},
8585
"overrides": {
86+
"expo": "54.0.21",
8687
"react-test-renderer": "19.1.0",
8788
},
8889
"packages": {

packages/react-native-healthkit/ios/WorkoutsModule.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,17 @@ class WorkoutsModule: HybridWorkoutsModuleSpec {
212212
store.save(workout) { (_: Bool, error: Error?) in
213213
if let error = error {
214214
return continuation.resume(throwing: error)
215-
}
216-
if !initializedSamples.isEmpty {
215+
} else if !initializedSamples.isEmpty {
217216
store.add(initializedSamples, to: workout) { (_, error: Error?) in
218217
if let error = error {
219218
return continuation.resume(throwing: error)
220219
}
220+
return continuation.resume()
221221
}
222+
} else {
223+
return continuation.resume()
222224
}
223-
return continuation.resume()
225+
224226
}
225227
}) as Void
226228

0 commit comments

Comments
 (0)