handle NPE in case service disconnects
This commit is contained in:
parent
1e6ff3579b
commit
c4cf845650
|
@ -1082,6 +1082,8 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
mHandler.sendMessage(msg);
|
mHandler.sendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mService != null)
|
||||||
|
{
|
||||||
long[] bws = mService.getBandwidth();
|
long[] bws = mService.getBandwidth();
|
||||||
Message msg = mHandler.obtainMessage(TorServiceConstants.MESSAGE_TRAFFIC_COUNT);
|
Message msg = mHandler.obtainMessage(TorServiceConstants.MESSAGE_TRAFFIC_COUNT);
|
||||||
msg.getData().putLong("download", bws[0]);
|
msg.getData().putLong("download", bws[0]);
|
||||||
|
@ -1092,12 +1094,13 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
|
|
||||||
try { Thread.sleep(1000); }
|
try { Thread.sleep(1000); }
|
||||||
catch (Exception e){}
|
catch (Exception e){}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mService != null)
|
||||||
torStatus = mService.getStatus();
|
torStatus = mService.getStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (RemoteException re)
|
catch (Exception re)
|
||||||
{
|
{
|
||||||
Log.e(TAG, "error getting service updates",re);
|
Log.e(TAG, "error getting service updates",re);
|
||||||
}
|
}
|
||||||
|
@ -1230,37 +1233,10 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
|
||||||
mKeepUpdating = false;
|
mKeepUpdating = false;
|
||||||
mService = null;
|
mService = null;
|
||||||
Log.d(TAG,"service was disconnected");
|
Log.d(TAG,"service was disconnected");
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
private void createProgressDialog (String msg)
|
|
||||||
{
|
|
||||||
if (progressDialog != null && progressDialog.isShowing())
|
|
||||||
{
|
|
||||||
progressDialog.setMessage(msg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
progressDialog = ProgressDialog.show(Orbot.this, "", msg);
|
|
||||||
progressDialog.setCancelable(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void hideProgressDialog ()
|
|
||||||
{
|
|
||||||
|
|
||||||
if (progressDialog != null && progressDialog.isShowing())
|
|
||||||
{
|
|
||||||
progressDialog.dismiss();
|
|
||||||
progressDialog = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
private void setLocale ()
|
private void setLocale ()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue