fix(accountDerivation): App is crashing when the account derivation fails in status-go

The crash is caused by missing `derivedAddresses` property on the response of fetchDerivedAddresses task
This commit is contained in:
Alex Jbanca 2023-06-27 06:28:16 +03:00 committed by Alex Jbanca
parent 8febd4d53d
commit bf62ef0366
2 changed files with 6 additions and 2 deletions

View File

@ -474,7 +474,11 @@ proc setDerivedAddresses[T](self: Module[T], derivedAddresses: seq[DerivedAddres
method onDerivedAddressesFetched*[T](self: Module[T], derivedAddresses: seq[DerivedAddressDto], error: string) = method onDerivedAddressesFetched*[T](self: Module[T], derivedAddresses: seq[DerivedAddressDto], error: string) =
if error.len > 0: if error.len > 0:
error "fetching derived addresses error", err=error error "fetching derived addresses error", err=error
self.fetchingAddressesIsInProgress = false
if self.authenticationReason == AuthenticationReason.AddingAccount:
self.view.setDisablePopup(false)
return return
let selectedOrigin = self.view.getSelectedOrigin() let selectedOrigin = self.view.getSelectedOrigin()
if selectedOrigin.getPairType() != KeyPairType.Profile.int and if selectedOrigin.getPairType() != KeyPairType.Profile.int and
selectedOrigin.getPairType() != KeyPairType.SeedImport.int: selectedOrigin.getPairType() != KeyPairType.SeedImport.int:

View File

@ -13,7 +13,7 @@ type
const fetchDerivedAddressesTask*: Task = proc(argEncoded: string) {.gcsafe, nimcall.} = const fetchDerivedAddressesTask*: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
let arg = decode[FetchDerivedAddressesTaskArg](argEncoded) let arg = decode[FetchDerivedAddressesTaskArg](argEncoded)
var output = %*{ var output = %*{
"derivedAddress": "", "derivedAddresses": "",
"error": "" "error": ""
} }
try: try:
@ -30,7 +30,7 @@ type
const fetchDerivedAddressesForMnemonicTask*: Task = proc(argEncoded: string) {.gcsafe, nimcall.} = const fetchDerivedAddressesForMnemonicTask*: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
let arg = decode[FetchDerivedAddressesForMnemonicTaskArg](argEncoded) let arg = decode[FetchDerivedAddressesForMnemonicTaskArg](argEncoded)
var output = %*{ var output = %*{
"derivedAddress": "", "derivedAddresses": "",
"error": "" "error": ""
} }
try: try: