Add assertions in various places to ensure tal_fmt doesn't receive NULL as argument for strings.

This commit is contained in:
Corné Plooy
2018-03-01 11:32:38 +01:00
committed by Christian Decker
parent aba3d5f34d
commit b857b2e843
11 changed files with 39 additions and 0 deletions

View File

@@ -489,6 +489,7 @@ static unsigned int htlc_id_from_pkt(const Pkt *pkt)
static Pkt *htlc_pkt(const tal_t *ctx, const char *prefix, unsigned int id)
{
assert(id != -1);
assert(prefix != NULL);
return (Pkt *)tal_fmt(ctx, "%s: HTLC #%u", prefix, id);
}
@@ -501,6 +502,7 @@ static unsigned int htlc_id_from_tx(const struct bitcoin_tx *tx)
static struct bitcoin_tx *htlc_tx(const tal_t *ctx,
const char *prefix, unsigned int id)
{
assert(prefix != NULL);
return (struct bitcoin_tx *)tal_fmt(ctx, "%s HTLC #%u", prefix, id);
}