FIX: possible crashes

This commit is contained in:
Overtorment 2019-01-05 16:16:28 +00:00
parent 2cd9a19d67
commit 2904afaf26
2 changed files with 9 additions and 3 deletions

View File

@ -35,6 +35,7 @@ export class User {
} }
async loadByAuthorization(authorization) { async loadByAuthorization(authorization) {
if (!authorization) return false;
let access_token = authorization.replace('Bearer ', ''); let access_token = authorization.replace('Bearer ', '');
let userid = await this._redis.get('userid_for_' + access_token); let userid = await this._redis.get('userid_for_' + access_token);

View File

@ -221,9 +221,14 @@ router.get('/gettxs', async function(req, res) {
} }
if (!(await u.getAddress())) await u.generateAddress(); // onchain addr needed further if (!(await u.getAddress())) await u.generateAddress(); // onchain addr needed further
await u.accountForPosibleTxids(); try {
let txs = await u.getTxs(); await u.accountForPosibleTxids();
res.send(txs); let txs = await u.getTxs();
res.send(txs);
} catch (Err) {
console.log(Err);
res.send([]);
}
}); });
router.get('/getuserinvoices', async function(req, res) { router.get('/getuserinvoices', async function(req, res) {