fix: check null

This commit is contained in:
Richard Ramos 2021-04-21 13:35:29 -04:00 committed by Iuri Matias
parent 19d4279237
commit 7d56e66a86

View File

@ -9,6 +9,7 @@ proc fromEvent*(jsonSignal: JsonNode): Signal =
signal.blockNumber = jsonSignal["event"]{"blockNumber"}.getInt signal.blockNumber = jsonSignal["event"]{"blockNumber"}.getInt
signal.erc20 = jsonSignal["event"]{"erc20"}.getBool signal.erc20 = jsonSignal["event"]{"erc20"}.getBool
signal.accounts = @[] signal.accounts = @[]
if jsonSignal["event"]["accounts"].kind != JNull:
for account in jsonSignal["event"]["accounts"]: for account in jsonSignal["event"]["accounts"]:
signal.accounts.add(account.getStr) signal.accounts.add(account.getStr)
result = signal result = signal