improve type checking in getFileSize
This commit is contained in:
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…
x
Reference in New Issue
Block a user