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

main
Vavassor 7 years ago
parent 292c4c3a88
commit fbd4150001
  1. 5
      app/src/main/java/com/keylesspalace/tusky/AccountActivity.java
  2. 8
      app/src/main/java/com/keylesspalace/tusky/LoginActivity.java

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

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

Loading…
Cancel
Save