mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 17:14:22 +01:00
db: Guard against accessing NULL partid and total_msat
These were spamming my logs and could result in misleading results being returned on `listpays` and `listsendpays`.
This commit is contained in:
committed by
Rusty Russell
parent
d12ea51e63
commit
1da977a04c
@@ -2749,8 +2749,16 @@ static struct wallet_payment *wallet_stmt2payment(const tal_t *ctx,
|
|||||||
else
|
else
|
||||||
payment->failonion = NULL;
|
payment->failonion = NULL;
|
||||||
|
|
||||||
db_column_amount_msat(stmt, 14, &payment->total_msat);
|
if (!db_column_is_null(stmt, 14))
|
||||||
payment->partid = db_column_u64(stmt, 15);
|
db_column_amount_msat(stmt, 14, &payment->total_msat);
|
||||||
|
else
|
||||||
|
payment->total_msat = AMOUNT_MSAT(0);
|
||||||
|
|
||||||
|
if (!db_column_is_null(stmt, 15))
|
||||||
|
payment->partid = db_column_u64(stmt, 15);
|
||||||
|
else
|
||||||
|
payment->partid = 0;
|
||||||
|
|
||||||
return payment;
|
return payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user