Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
Fix error were object could be undefined given an approval event
Browse files Browse the repository at this point in the history
  • Loading branch information
dekz committed Mar 14, 2019
1 parent af04c29 commit f285745
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions packages/order-watcher/CHANGELOG.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
{
"note": "Update websocket from ^1.0.25 to ^1.0.26",
"pr": 1685
},
{
"note": "Fix issue where ERC721 Approval events could cause a lookup on undefined object"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@ export class DependentOrderHashesTracker {
this._zrxTokenAddress = zrxTokenAddress;
}
public getDependentOrderHashesByERC721ByMaker(makerAddress: string, tokenAddress: string): string[] {
const orderHashSets = _.values(
this._orderHashesByERC721AddressByTokenIdByMakerAddress[makerAddress][tokenAddress],
);
let orderHashSets: Array<Set<string>> = [];
if (
this._orderHashesByERC721AddressByTokenIdByMakerAddress[makerAddress] &&
this._orderHashesByERC721AddressByTokenIdByMakerAddress[makerAddress][tokenAddress]
) {
orderHashSets = _.values(
this._orderHashesByERC721AddressByTokenIdByMakerAddress[makerAddress][tokenAddress],
);
}
const orderHashList = _.reduce(
orderHashSets,
(accumulator, orderHashSet) => [...accumulator, ...orderHashSet],
Expand Down

0 comments on commit f285745

Please sign in to comment.