Add assertions to clarify our assumptions about msg != NULL

This commit is contained in:
practicalswift 2018-02-19 10:59:31 +01:00 committed by Christian Decker
parent ea3ee01215
commit f351417905
2 changed files with 6 additions and 4 deletions

View File

@ -636,8 +636,8 @@ static void json_sendpay_on_resolve(const struct sendpay_result *r,
{ {
struct command *cmd = (struct command*) vcmd; struct command *cmd = (struct command*) vcmd;
struct json_result *data; struct json_result *data = NULL;
const char *msg; const char *msg = NULL;
struct routing_failure *fail; struct routing_failure *fail;
if (r->succeeded) if (r->succeeded)
@ -693,6 +693,7 @@ static void json_sendpay_on_resolve(const struct sendpay_result *r,
break; break;
} }
assert(msg);
command_fail_detailed(cmd, r->errorcode, data, "%s", msg); command_fail_detailed(cmd, r->errorcode, data, "%s", msg);
} }
} }

View File

@ -51,8 +51,8 @@ json_pay_success(struct command *cmd,
static void json_pay_failure(struct command *cmd, static void json_pay_failure(struct command *cmd,
const struct sendpay_result *r) const struct sendpay_result *r)
{ {
struct json_result *data; struct json_result *data = NULL;
const char *msg; const char *msg = NULL;
struct routing_failure *fail; struct routing_failure *fail;
assert(!r->succeeded); assert(!r->succeeded);
@ -109,6 +109,7 @@ static void json_pay_failure(struct command *cmd,
break; break;
} }
assert(msg);
command_fail_detailed(cmd, r->errorcode, data, "%s", msg); command_fail_detailed(cmd, r->errorcode, data, "%s", msg);
} }