diff --git a/libs/lpac-jni/src/main/java/net/typeblog/lpac_jni/impl/LocalProfileAssistantImpl.kt b/libs/lpac-jni/src/main/java/net/typeblog/lpac_jni/impl/LocalProfileAssistantImpl.kt index 11a9931..e9856cd 100644 --- a/libs/lpac-jni/src/main/java/net/typeblog/lpac_jni/impl/LocalProfileAssistantImpl.kt +++ b/libs/lpac-jni/src/main/java/net/typeblog/lpac_jni/impl/LocalProfileAssistantImpl.kt @@ -3,6 +3,7 @@ package net.typeblog.lpac_jni.impl import android.util.Log import net.typeblog.lpac_jni.LpacJni import net.typeblog.lpac_jni.ApduInterface +import net.typeblog.lpac_jni.EuiccConfiguredAddresses import net.typeblog.lpac_jni.EuiccInfo2 import net.typeblog.lpac_jni.HttpInterface import net.typeblog.lpac_jni.HttpInterface.HttpResponse @@ -94,7 +95,7 @@ class LocalProfileAssistantImpl( LpacJni.euiccSetMss(contextHandle, mss) } - override fun getEuiccConfiguredAddresses() = + override fun getEuiccConfiguredAddresses(): EuiccConfiguredAddresses = LpacJni.es10aGetEuiccConfiguredAddresses(contextHandle) override val valid: Boolean @@ -216,20 +217,21 @@ class LocalProfileAssistantImpl( callback ) - if (res == 0) return - // Construct the error now to store any error information we _can_ access - val err = LocalProfileAssistant.ProfileDownloadException( - lpaErrorReason = LpacJni.downloadErrCodeToString(-res), - httpInterface.lastHttpResponse, - httpInterface.lastHttpException, - apduInterface.lastApduResponse, - apduInterface.lastApduException, - ) + if (res != 0) { + // Construct the error now to store any error information we _can_ access + val err = LocalProfileAssistant.ProfileDownloadException( + lpaErrorReason = LpacJni.downloadErrCodeToString(-res), + httpInterface.lastHttpResponse, + httpInterface.lastHttpException, + apduInterface.lastApduResponse, + apduInterface.lastApduException, + ) - // Cancel sessions if possible. This will overwrite recorded errors from HTTP and APDU interfaces. - LpacJni.cancelSessions(contextHandle) + // Cancel sessions if possible. This will overwrite recorded errors from HTTP and APDU interfaces. + LpacJni.cancelSessions(contextHandle) - throw err + throw err + } } override fun discoveryProfile(smds: String, imei: String?, callback: ProfileDiscoveryCallback) {