From f82278a25c7f4246699fa420e8eb2723b0d893a5 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 10 Apr 2017 17:38:25 +0200 Subject: [PATCH] handle return of undefined hash --- www/common/pinpad.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/www/common/pinpad.js b/www/common/pinpad.js index edf542973..78ae607db 100644 --- a/www/common/pinpad.js +++ b/www/common/pinpad.js @@ -25,13 +25,13 @@ define([ exp.send = rpc.send; // you can ask the server to pin a particular channel for you - exp.pin = function (channel, cb) { - rpc.send('PIN', channel, cb); + exp.pin = function (channels, cb) { + rpc.send('PIN', channels, cb); }; // you can also ask to unpin a particular channel - exp.unpin = function (channel, cb) { - rpc.send('UNPIN', channel, cb); + exp.unpin = function (channels, cb) { + rpc.send('UNPIN', channels, cb); }; // This implementation must match that on the server @@ -44,6 +44,9 @@ define([ // ask the server what it thinks your hash is exp.getServerHash = function (cb) { rpc.send('GET_HASH', edPublic, function (e, hash) { + if (!(hash && hash[0])) { + return void cb('NO_HASH_RETURNED'); + } cb(e, hash[0]); }); };