aboutsummaryrefslogtreecommitdiffstats
path: root/src/contract_wrappers
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-10-06 18:15:11 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-10-06 18:15:11 +0800
commit81297b44c6392e1cb995848a5f81bdc3ce6108be (patch)
treeca5995a23ce409e3ffe4ea0d8ef347c26008793f /src/contract_wrappers
parenta2cc127ea97907cd83acbd2cc49fb7892c6b11de (diff)
downloaddexon-sol-tools-81297b44c6392e1cb995848a5f81bdc3ce6108be.tar
dexon-sol-tools-81297b44c6392e1cb995848a5f81bdc3ce6108be.tar.gz
dexon-sol-tools-81297b44c6392e1cb995848a5f81bdc3ce6108be.tar.bz2
dexon-sol-tools-81297b44c6392e1cb995848a5f81bdc3ce6108be.tar.lz
dexon-sol-tools-81297b44c6392e1cb995848a5f81bdc3ce6108be.tar.xz
dexon-sol-tools-81297b44c6392e1cb995848a5f81bdc3ce6108be.tar.zst
dexon-sol-tools-81297b44c6392e1cb995848a5f81bdc3ce6108be.zip
Add undefined check
Diffstat (limited to 'src/contract_wrappers')
-rw-r--r--src/contract_wrappers/contract_wrapper.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/contract_wrappers/contract_wrapper.ts b/src/contract_wrappers/contract_wrapper.ts
index 492d40a28..f6ccfdee4 100644
--- a/src/contract_wrappers/contract_wrapper.ts
+++ b/src/contract_wrappers/contract_wrapper.ts
@@ -123,6 +123,9 @@ export class ContractWrapper {
private async _reconcileBlockAsync(): Promise<void> {
const latestBlock = await this._web3Wrapper.getBlockAsync(BlockParamLiteral.Latest);
// We need to coerce to Block type cause Web3.Block includes types for mempool blocks
- (this._blockAndLogStreamer as BlockAndLogStreamer).reconcileNewBlock(latestBlock as any as Block);
+ if (!_.isUndefined(this._blockAndLogStreamer)) {
+ // If we clear the interval while fetching the block - this._blockAndLogStreamer will be undefined
+ this._blockAndLogStreamer.reconcileNewBlock(latestBlock as any as Block);
+ }
}
}