problem: nullpointer stacktrace if json is just "null"

This commit is contained in:
Igor Artamonov
2021-02-16 17:15:00 -05:00
parent 73d94879cd
commit d60154d893
2 changed files with 15 additions and 1 deletions

View File

@@ -46,7 +46,8 @@ class CacheRequested(
if (params.size != 1) {
return
}
val parsed = Global.objectMapper.readValue(json, TransactionReceiptJson::class.java)
// note: json could be a `null` value
val parsed = Global.objectMapper.readValue(json, TransactionReceiptJson::class.java) ?: return
val value = DefaultContainer<TransactionReceiptJson>(
TxId.from(parsed.transactionHash),
BlockId.from(parsed.blockHash),