Skip to content

Commit

Permalink
Merge pull request #116 from tonkeeper/fix-tk-invalid-data-crash
Browse files Browse the repository at this point in the history
fix invalid data crash
  • Loading branch information
sorokin0andrey authored Jan 9, 2025
2 parents 8cf24ee + 1d55855 commit b401e4f
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,18 @@ class SendTransactionViewModel(

private val emulationReadyDate = AtomicLong(0)

var message: MessageBodyEntity? = null

init {
viewModelScope.launch(Dispatchers.IO) {
val tokens = getTokens()
val transfers = transfers(tokens.filter { it.isRequestMinting }, true)
val message = accountRepository.messageBody(wallet, request.validUntil, transfers)
val internalMessage = (forceRelayer || settingsRepository.batteryIsEnabledTx(wallet.accountId, batteryTransactionType))
try {
val transfers = transfers(tokens.filter { it.isRequestMinting }, true)
message = accountRepository.messageBody(wallet, request.validUntil, transfers)

val emulated = emulationUseCase(
message = message,
message = message!!,
useBattery = settingsRepository.batteryIsEnabledTx(wallet.accountId, batteryTransactionType),
forceRelayer = forceRelayer,
params = true
Expand Down Expand Up @@ -128,7 +131,7 @@ class SendTransactionViewModel(
}
} catch (e: Throwable) {
FirebaseCrashlytics.getInstance().recordException(APIException.Emulation(
boc = message.createSignedBody(EmptyPrivateKeyEd25519.invoke(), internalMessage).base64(),
boc = message?.createSignedBody(EmptyPrivateKeyEd25519.invoke(), internalMessage)?.base64() ?: "failed",
sourceUri = request.appUri,
cause = e
))
Expand Down

0 comments on commit b401e4f

Please sign in to comment.