Skip to content

Commit dcfc431

Browse files
authored
fix(ios): prevent crash on color values with high alpha (#234)
`Int32(value)` traps when ARGB color values exceed `Int32.max` (e.g. `0xFF0000FF` = opaque blue). Uses `Int64` + `truncatingIfNeeded` for safe conversion.
1 parent 018c63d commit dcfc431

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ios/new/HybridViewModelColorProperty.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@_spi(RiveExperimental) import RiveRuntime
1+
import RiveRuntime
22
import NitroModules
33

44
class HybridViewModelColorProperty: HybridViewModelColorPropertySpec {
@@ -32,7 +32,7 @@ class HybridViewModelColorProperty: HybridViewModelColorPropertySpec {
3232
}
3333

3434
func set(value: Double) throws {
35-
let color = Color(UInt32(bitPattern: Int32(value)))
35+
let color = Color(UInt32(truncatingIfNeeded: Int64(value)))
3636
let inst = instance
3737
let p = prop
3838
Task { @MainActor in

0 commit comments

Comments
 (0)