From da533b106a8d38c7b9a6e6009ce9c5f68a095aef Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 8 Jun 2017 11:24:12 +0200 Subject: [PATCH] improve type checking in getFileSize --- www/common/pinpad.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/common/pinpad.js b/www/common/pinpad.js index ff1a37c44..6dd153c9c 100644 --- a/www/common/pinpad.js +++ b/www/common/pinpad.js @@ -92,8 +92,8 @@ define([ exp.getFileSize = function (file, cb) { rpc.send('GET_FILE_SIZE', file, function (e, response) { if (e) { return void cb(e); } - if (response && response.length) { - cb(void 0, response[0]); + if (response && response.length && typeof(response[0]) === 'number') { + return void cb(void 0, response[0]); } else { cb('INVALID_RESPONSE'); }