FIX: potential crash

This commit is contained in:
Overtorment 2019-01-06 13:17:52 +00:00
parent a42d331e38
commit 4f345b20a8

View File

@ -172,6 +172,10 @@ router.post('/payinvoice', async function(req, res) {
return errorLnd(res); return errorLnd(res);
} }
}); });
if (!info.num_satoshis && !info.num_satoshis) {
// tip invoice, but someone forgot to specify amount
return errorBadArguments(res);
}
let inv = { payment_request: req.body.invoice, amt: info.num_satoshis }; // amt is used only for 'tip' invoices let inv = { payment_request: req.body.invoice, amt: info.num_satoshis }; // amt is used only for 'tip' invoices
try { try {
logger.log('/payinvoice', [req.id, 'before write', JSON.stringify(inv)]); logger.log('/payinvoice', [req.id, 'before write', JSON.stringify(inv)]);