diff --git a/plugins/offers_inv_hook.c b/plugins/offers_inv_hook.c index 0e3128ae6..bfeb5b87f 100644 --- a/plugins/offers_inv_hook.c +++ b/plugins/offers_inv_hook.c @@ -28,12 +28,15 @@ fail_inv_level(struct command *cmd, struct tlv_invoice_error *err; u8 *errdata; - full_fmt = tal_fmt(tmpctx, "Failed invoice %s", - invoice_encode(tmpctx, inv->inv)); - if (inv->inv->offer_id) - tal_append_fmt(&full_fmt, " for offer %s", - type_to_string(tmpctx, struct sha256, - inv->inv->offer_id)); + full_fmt = tal_fmt(tmpctx, "Failed invoice"); + if (inv->inv) { + tal_append_fmt(&full_fmt, " %s", + invoice_encode(tmpctx, inv->inv)); + if (inv->inv->offer_id) + tal_append_fmt(&full_fmt, " for offer %s", + type_to_string(tmpctx, struct sha256, + inv->inv->offer_id)); + } tal_append_fmt(&full_fmt, ": %s", fmt); msg = tal_vfmt(tmpctx, full_fmt, ap); diff --git a/plugins/offers_invreq_hook.c b/plugins/offers_invreq_hook.c index 1092c7c06..f4b131ff6 100644 --- a/plugins/offers_invreq_hook.c +++ b/plugins/offers_invreq_hook.c @@ -38,12 +38,15 @@ fail_invreq_level(struct command *cmd, struct tlv_invoice_error *err; u8 *errdata; - full_fmt = tal_fmt(tmpctx, "Failed invoice_request %s", - invrequest_encode(tmpctx, invreq->invreq)); - if (invreq->invreq->offer_id) - tal_append_fmt(&full_fmt, " for offer %s", - type_to_string(tmpctx, struct sha256, - invreq->invreq->offer_id)); + full_fmt = tal_fmt(tmpctx, "Failed invoice_request"); + if (invreq->invreq) { + tal_append_fmt(&full_fmt, " %s", + invrequest_encode(tmpctx, invreq->invreq)); + if (invreq->invreq->offer_id) + tal_append_fmt(&full_fmt, " for offer %s", + type_to_string(tmpctx, struct sha256, + invreq->invreq->offer_id)); + } tal_append_fmt(&full_fmt, ": %s", fmt); msg = tal_vfmt(tmpctx, full_fmt, ap);