diff options
author | Martin Fietz <martin.fietz@gmail.com> | 2018-01-10 21:59:13 +0100 |
---|---|---|
committer | Martin Fietz <martin.fietz@gmail.com> | 2018-01-10 21:59:13 +0100 |
commit | 21ac9d158f4d81b082b8cb1d6f65146ed5c4c4ca (patch) | |
tree | dea0fb4a717148fdee5b5e0a1dcdd327977fb7e4 /app/src/main | |
parent | ba3eb5e784ac4f55ea28b60326200f1c2a8d0c5d (diff) | |
download | AntennaPod-21ac9d158f4d81b082b8cb1d6f65146ed5c4c4ca.zip |
Avoid NPE
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index 604dcb960..defceb09b 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -8,6 +8,7 @@ import android.os.Bundle; import android.os.Looper; import android.support.annotation.UiThread; import android.support.v4.app.NavUtils; +import android.support.v7.app.ActionBar; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; @@ -113,9 +114,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity { feeds -> { OnlineFeedViewActivity.this.feeds = feeds; setSubscribeButtonState(feed); - }, error -> { - Log.e(TAG, Log.getStackTraceString(error)); - } + }, error -> Log.e(TAG, Log.getStackTraceString(error)) ); } else if ((arg & EVENTS) != 0) { setSubscribeButtonState(feed); @@ -132,10 +131,13 @@ public class OnlineFeedViewActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { setTheme(UserPreferences.getTheme()); super.onCreate(savedInstanceState); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); + ActionBar actionBar = getSupportActionBar(); + if(actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } - if (getIntent() != null && getIntent().hasExtra(ARG_TITLE)) { - getSupportActionBar().setTitle(getIntent().getStringExtra(ARG_TITLE)); + if (actionBar != null && getIntent() != null && getIntent().hasExtra(ARG_TITLE)) { + actionBar.setTitle(getIntent().getStringExtra(ARG_TITLE)); } StorageUtils.checkStorageAvailability(this); @@ -147,7 +149,9 @@ public class OnlineFeedViewActivity extends AppCompatActivity { || TextUtils.equals(getIntent().getAction(), Intent.ACTION_VIEW)) { feedUrl = (TextUtils.equals(getIntent().getAction(), Intent.ACTION_SEND)) ? getIntent().getStringExtra(Intent.EXTRA_TEXT) : getIntent().getDataString(); - getSupportActionBar().setTitle(R.string.add_feed_label); + if(actionBar != null) { + actionBar.setTitle(R.string.add_feed_label); + } } else { throw new IllegalArgumentException("Activity must be started with feedurl argument!"); } |