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.
This commit is contained in:
parent
405344aa07
commit
ed5cdb6d49
1 changed files with 1 additions and 1 deletions
|
@ -86,8 +86,8 @@ class NodeRepository(private val nodeDao: NodeDao) {
|
||||||
val updatePeriod = Constants.NODES_UPDATE_PERIOD
|
val updatePeriod = Constants.NODES_UPDATE_PERIOD
|
||||||
// Verify if nodes list should be updated
|
// Verify if nodes list should be updated
|
||||||
if (now - updatePeriod > lastUpdate) {
|
if (now - updatePeriod > lastUpdate) {
|
||||||
val response = mBitsyWebservice?.getNodes()
|
|
||||||
try {
|
try {
|
||||||
|
val response = mBitsyWebservice?.getNodes()
|
||||||
// Update the list of nodes only if we got at least MIN_NODES_SIZE nodes
|
// 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) {
|
if (response?.isSuccessful == true && (response.body()?.size ?: 0) >= MIN_NODES_SIZE) {
|
||||||
val nodesWS = response.body() ?: return
|
val nodesWS = response.body() ?: return
|
||||||
|
|
Loading…
Reference in a new issue