Fixes a crash on login and another when clicking the mention button on an account page that hasn't loaded yet.

This commit is contained in:
Vavassor 2017-03-27 22:13:55 -04:00
parent 292c4c3a88
commit fbd4150001
2 changed files with 9 additions and 4 deletions

View file

@ -481,6 +481,10 @@ public class AccountActivity extends BaseActivity {
return true;
}
case R.id.action_mention: {
if (loadedAccount == null) {
// If the account isn't loaded yet, eat the input.
return false;
}
Intent intent = new Intent(this, ComposeActivity.class);
intent.putExtra("mentioned_usernames", new String[] { loadedAccount.username });
startActivity(intent);
@ -488,6 +492,7 @@ public class AccountActivity extends BaseActivity {
}
case R.id.action_open_in_web: {
if (loadedAccount == null) {
// If the account isn't loaded yet, eat the input.
return false;
}
Uri uri = Uri.parse(loadedAccount.url);

View file

@ -217,8 +217,8 @@ public class LoginActivity extends AppCompatActivity {
}
@Override
protected void onPause() {
super.onPause();
protected void onStop() {
super.onStop();
SharedPreferences.Editor editor = preferences.edit();
editor.putString("domain", domain);
editor.putString("clientId", clientId);
@ -238,8 +238,8 @@ public class LoginActivity extends AppCompatActivity {
}
@Override
protected void onResume() {
super.onResume();
protected void onStart() {
super.onStart();
/* Check if we are resuming during authorization by seeing if the intent contains the
* redirect that was given to the server. If so, its response is here! */
Uri uri = getIntent().getData();