Merge pull request #1437 from AlphaWallet/fix-overflow-721

ensure overflowed integers on 721 balance count doesn't break
pull/1442/head
James Sangalli 5 years ago committed by GitHub
commit c3a7276492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      AlphaWallet/Tokens/Types/TokensDataStore.swift

@ -281,7 +281,11 @@ class TokensDataStore {
getERC721BalanceCoordinator.getERC721TokenBalance(for: account.address, contract: address) { result in
switch result {
case .success(let balance):
completion(.success([String](repeating: "0", count: Int(balance))))
if balance >= Int.max {
completion(.failure(AnyError(Web3Error(description: ""))))
} else {
completion(.success([String](repeating: "0", count: Int(balance))))
}
case .failure(let error):
completion(.failure(error))
}

Loading…
Cancel
Save