Avoid NPE by proper initialization instead of null check later on

This commit is contained in:
cketti 2016-12-02 17:00:39 +01:00
parent 833adc732e
commit c7c21cb602

View file

@ -104,6 +104,8 @@ public class UpgradeDatabases extends K9Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
decodeExtras();
// If the databases have already been upgraded there's no point in displaying this activity.
if (K9.areDatabasesUpToDate()) {
launchOriginalActivity();
@ -114,8 +116,6 @@ public class UpgradeDatabases extends K9Activity {
initializeLayout();
decodeExtras();
setupBroadcastReceiver();
}
@ -180,10 +180,8 @@ public class UpgradeDatabases extends K9Activity {
*/
private void launchOriginalActivity() {
finish();
if (mStartIntent != null) {
startActivity(mStartIntent);
}
}
/**
* Receiver for broadcasts send by {@link DatabaseUpgradeService}.