From 4f345b20a8d8a55b06b9c00262e67636e9c91309 Mon Sep 17 00:00:00 2001 From: Overtorment Date: Sun, 6 Jan 2019 13:17:52 +0000 Subject: [PATCH] FIX: potential crash --- controllers/api.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controllers/api.js b/controllers/api.js index e076f55..9b24387 100644 --- a/controllers/api.js +++ b/controllers/api.js @@ -172,6 +172,10 @@ router.post('/payinvoice', async function(req, 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 try { logger.log('/payinvoice', [req.id, 'before write', JSON.stringify(inv)]);