From 70cae0d2c3ec62496cff97d573f925ad6d236790 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 22 May 2017 18:43:06 +0200 Subject: [PATCH] safely access pin reset response --- www/common/pinpad.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/www/common/pinpad.js b/www/common/pinpad.js index b14a5bac0..dbd7c8b22 100644 --- a/www/common/pinpad.js +++ b/www/common/pinpad.js @@ -77,6 +77,13 @@ define([ return; } rpc.send('RESET', channels, function (e, response) { + if (e) { + return void cb(e); + } + if (!response.length) { + console.log(response); + return void cb('INVALID_RESPONSE'); + } cb(e, response[0]); }); };