safely access pin reset response

pull/1/head
ansuz 2017-05-22 18:43:06 +02:00
parent 2ca6277660
commit 70cae0d2c3
1 changed files with 7 additions and 0 deletions

View File

@ -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]);
});
};