commit 45105572d945998013cca9d4173e796064f658c8 Author: Nathan Freitas nathan@freitas.net Date: Wed Nov 16 07:50:40 2016 -0500
if there is no status intent yet, then create one, and don't NPE --- app/src/main/java/org/torproject/android/OrbotMainActivity.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java index c43928e..7706c0f 100644 --- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java +++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java @@ -103,7 +103,7 @@ public class OrbotMainActivity extends AppCompatActivity private ActionBarDrawerToggle mDrawerToggle; /* Some tracking bits */ - private String torStatus = null; //latest status reported from the tor service + private String torStatus = TorServiceConstants.STATUS_OFF; //latest status reported from the tor service private Intent lastStatusIntent; // the last ACTION_STATUS Intent received
private SharedPreferences mPrefs = null; @@ -1193,7 +1193,11 @@ public class OrbotMainActivity extends AppCompatActivity if (autoStartFromIntent) { autoStartFromIntent = false; - Intent resultIntent = lastStatusIntent; + Intent resultIntent = lastStatusIntent; + + if (resultIntent == null) + resultIntent = new Intent(TorServiceConstants.ACTION_START); + resultIntent.putExtra(TorServiceConstants.EXTRA_STATUS, torStatus); setResult(RESULT_OK, resultIntent); finish();