Avoid crash in NodeRepository.

- The crash was happening due to an unhandled exception, the problem was that the statement that was raising an exception was out of the try/catch block.
master
Severiano Jaramillo 2019-09-27 17:50:32 -05:00
parent 405344aa07
commit ed5cdb6d49
1 changed files with 1 additions and 1 deletions

View File

@ -86,8 +86,8 @@ class NodeRepository(private val nodeDao: NodeDao) {
val updatePeriod = Constants.NODES_UPDATE_PERIOD
// Verify if nodes list should be updated
if (now - updatePeriod > lastUpdate) {
val response = mBitsyWebservice?.getNodes()
try {
val response = mBitsyWebservice?.getNodes()
// Update the list of nodes only if we got at least MIN_NODES_SIZE nodes
if (response?.isSuccessful == true && (response.body()?.size ?: 0) >= MIN_NODES_SIZE) {
val nodesWS = response.body() ?: return