Skip to content

Commit 01fdb42

Browse files
committed
fix(ios): prevent crash on color values with high alpha bit
Int32(value) traps when ARGB color values exceed Int32.max (alpha >= 0x80). Use Int64 + truncatingIfNeeded for safe bit-pattern conversion.
1 parent cb1f1f5 commit 01fdb42

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)