improve type checking in getFileSize

pull/1/head
ansuz 8 years ago
parent 5cbfc1a23c
commit da533b106a

@ -92,8 +92,8 @@ define([
exp.getFileSize = function (file, cb) { exp.getFileSize = function (file, cb) {
rpc.send('GET_FILE_SIZE', file, function (e, response) { rpc.send('GET_FILE_SIZE', file, function (e, response) {
if (e) { return void cb(e); } if (e) { return void cb(e); }
if (response && response.length) { if (response && response.length && typeof(response[0]) === 'number') {
cb(void 0, response[0]); return void cb(void 0, response[0]);
} else { } else {
cb('INVALID_RESPONSE'); cb('INVALID_RESPONSE');
} }

Loading…
Cancel
Save