Skip to content

Commit

Permalink
fix accidental cache bypass if balance==0
Browse files Browse the repository at this point in the history
  • Loading branch information
tintinweb committed Nov 23, 2021
1 parent c1b8332 commit bd45998
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/features/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ async function provideBalanceHover(document, position, token) {
//cconf.name, enabled

try {
if(!balance){

if(balance === undefined){
let etherscan = new EtherScanIo(cconf.apiKey, cconf.apiurl);
balance = await etherscan.balanceForAddress(address);
//balance = await etherscan.api.account.balance(address); //etherscanapi does not support custom chains
Expand Down
2 changes: 1 addition & 1 deletion src/features/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TimeoutCache {
}

get(prefix, key, def){
return this.data[`${prefix}+${key}`] || def;
return this.data[`${prefix}+${key}`] !== undefined ? this.data[`${prefix}+${key}`] : def;
}
}

Expand Down

0 comments on commit bd45998

Please sign in to comment.