diff --git a/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/ByteArrayExt.kt b/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/ByteArrayExt.kt index ec5923272a1..eca16bc383b 100644 --- a/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/ByteArrayExt.kt +++ b/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/ByteArrayExt.kt @@ -8,8 +8,12 @@ import kotlinx.cinterop.COpaquePointer import kotlinx.cinterop.readBytes import kotlinx.cinterop.toCValues -internal fun COpaquePointer?.readTwBytes(): ByteArray? = - TWDataBytes(this)?.readBytes(TWDataSize(this).toInt()) +internal fun COpaquePointer?.readTwBytes(): ByteArray? { + if (this == null) { + return null; + } + return TWDataBytes(this)?.readBytes(TWDataSize(this).toInt()) +} @OptIn(ExperimentalUnsignedTypes::class) internal fun ByteArray?.toTwData(): COpaquePointer? =