diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-10-06 18:15:11 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-10-06 18:15:11 +0800 |
commit | 81297b44c6392e1cb995848a5f81bdc3ce6108be (patch) | |
tree | ca5995a23ce409e3ffe4ea0d8ef347c26008793f /src | |
parent | a2cc127ea97907cd83acbd2cc49fb7892c6b11de (diff) | |
download | dexon-0x-contracts-81297b44c6392e1cb995848a5f81bdc3ce6108be.tar.gz dexon-0x-contracts-81297b44c6392e1cb995848a5f81bdc3ce6108be.tar.zst dexon-0x-contracts-81297b44c6392e1cb995848a5f81bdc3ce6108be.zip |
Add undefined check
Diffstat (limited to 'src')
-rw-r--r-- | src/contract_wrappers/contract_wrapper.ts | 5 |
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); + } } } |