[#1096] Fix null mined height crash

This handles the state in which is a transaction after it’s created with mined height null. It then doesn’t try to convert such a height into a BlockHeight object which is doing validation on input height. It rather returns null, similarly as for expiry height.
This commit is contained in:
Honza Rychnovský 2023-07-05 14:18:49 +02:00 committed by GitHub
parent 89ee0190af
commit 0a3efdbb6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -86,11 +86,16 @@ internal class AllTransactionView(
val isSent = netValueLong < 0
val expiryHeightLong = cursor.getLong(expiryHeightIndex)
val minedHeightLong = cursor.getLong(minedHeightColumnIndex)
DbTransactionOverview(
id = cursor.getLong(idColumnIndex),
rawId = FirstClassByteArray(cursor.getBlob(rawTransactionIdIndex)),
minedHeight = BlockHeight.new(zcashNetwork, cursor.getLong(minedHeightColumnIndex)),
minedHeight = if (0L == minedHeightLong) {
null
} else {
BlockHeight.new(zcashNetwork, minedHeightLong)
},
expiryHeight = if (0L == expiryHeightLong) {
null
} else {