Preventing a NullPointerException while handling a node disconnection
This commit is contained in:
parent
af5896a160
commit
843aacb859
1 changed files with 8 additions and 6 deletions
|
@ -690,19 +690,21 @@ public class NetworkService extends Service {
|
||||||
|
|
||||||
isLoggedIn = false;
|
isLoggedIn = false;
|
||||||
|
|
||||||
|
if(mSelectedNode != null){
|
||||||
// Marking the selected node as not connected
|
// Marking the selected node as not connected
|
||||||
mSelectedNode.setConnected(false);
|
mSelectedNode.setConnected(false);
|
||||||
|
|
||||||
// Updating the selected node's 'connected' status on the NodeLatencyVerifier instance
|
// Updating the selected node's 'connected' status on the NodeLatencyVerifier instance
|
||||||
if(nodeLatencyVerifier != null)
|
if(nodeLatencyVerifier != null)
|
||||||
nodeLatencyVerifier.updateActiveNodeInformation(mSelectedNode);
|
nodeLatencyVerifier.updateActiveNodeInformation(mSelectedNode);
|
||||||
|
}
|
||||||
|
|
||||||
if(tryReconnection) {
|
if(tryReconnection) {
|
||||||
// Registering current status
|
// Registering current status
|
||||||
mCurrentId = 0;
|
mCurrentId = 0;
|
||||||
mApiIds.clear();
|
mApiIds.clear();
|
||||||
|
|
||||||
if (removeSelectedNode) {
|
if (removeSelectedNode && mSelectedNode != null) {
|
||||||
// Remove node from node provider so that it is not returned for following connections
|
// Remove node from node provider so that it is not returned for following connections
|
||||||
nodeProvider.removeNode(mSelectedNode);
|
nodeProvider.removeNode(mSelectedNode);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue