Skip to content

Commit ad3a1ee

Browse files
Add assertions to clarify our assumptions about msg != NULL
1 parent 4653493 commit ad3a1ee

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lightningd/pay.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ static void json_sendpay_on_resolve(const struct sendpay_result *r,
637637
struct command *cmd = (struct command*) vcmd;
638638

639639
struct json_result *data;
640-
const char *msg;
640+
const char *msg = NULL;
641641
struct routing_failure *fail;
642642

643643
if (r->succeeded)
@@ -693,6 +693,7 @@ static void json_sendpay_on_resolve(const struct sendpay_result *r,
693693
break;
694694
}
695695

696+
assert(msg);
696697
command_fail_detailed(cmd, r->errorcode, data, "%s", msg);
697698
}
698699
}

lightningd/payalgo.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static void json_pay_failure(struct command *cmd,
5252
const struct sendpay_result *r)
5353
{
5454
struct json_result *data;
55-
const char *msg;
55+
const char *msg = NULL;
5656
struct routing_failure *fail;
5757

5858
assert(!r->succeeded);
@@ -109,6 +109,7 @@ static void json_pay_failure(struct command *cmd,
109109
break;
110110
}
111111

112+
assert(msg);
112113
command_fail_detailed(cmd, r->errorcode, data, "%s", msg);
113114
}
114115

0 commit comments

Comments
 (0)