plugins/offers: fix crash when we report unpaid prev invoice.

And add annotation so compiler spots it!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2021-07-08 14:57:38 +09:30 committed by neil saitug
parent 2aa833d424
commit 6aaecbc7b3

View file

@ -65,7 +65,7 @@ fail_invreq_level(struct command *cmd,
"invoice_error", errdata); "invoice_error", errdata);
} }
static struct command_result *WARN_UNUSED_RESULT static struct command_result *WARN_UNUSED_RESULT PRINTF_FMT(3,4)
fail_invreq(struct command *cmd, fail_invreq(struct command *cmd,
const struct invreq *invreq, const struct invreq *invreq,
const char *fmt, ...) const char *fmt, ...)
@ -361,7 +361,7 @@ static struct command_result *prev_invoice_done(struct command *cmd,
status = json_get_member(buf, arr + 1, "status"); status = json_get_member(buf, arr + 1, "status");
if (!json_tok_streq(buf, status, "paid")) { if (!json_tok_streq(buf, status, "paid")) {
return fail_invreq(cmd, ir, return fail_invreq(cmd, ir,
"Previous invoice #%u status *.%s", "Previous invoice #%u status %.*s",
*ir->inv->recurrence_counter - 1, *ir->inv->recurrence_counter - 1,
json_tok_full_len(status), json_tok_full_len(status),
json_tok_full(buf, status)); json_tok_full(buf, status));