diff options
author | Scott Jackson <daneren2005@gmail.com> | 2016-01-13 17:36:02 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2016-01-13 17:36:02 -0800 |
commit | 00d91d4caa811eb33eaf543813c893021955d355 (patch) | |
tree | 791767dda16139355c392c6c05f0bbc86db46eb4 /app/src/main | |
parent | bc2a7d3674903b8fba986135f7ca3327bac99d6b (diff) | |
download | dsub-00d91d4caa811eb33eaf543813c893021955d355.tar.gz dsub-00d91d4caa811eb33eaf543813c893021955d355.tar.bz2 dsub-00d91d4caa811eb33eaf543813c893021955d355.zip |
Fix some misc crashes
Diffstat (limited to 'app/src/main')
3 files changed, 13 insertions, 4 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cb03323c..f03e4ea4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="github.daneren2005.dsub" android:installLocation="internalOnly" - android:versionCode="169" + android:versionCode="170" android:versionName="5.1.3"> <instrumentation android:name="android.test.InstrumentationTestRunner" diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java index f9c14439..793d976f 100644 --- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -537,7 +537,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { int top = spinnerAdapter.getCount() - 1; if(position < top) { - for(int i = top; i > position; i--) { + for(int i = top; i > position && i >= 0; i--) { removeCurrent(); } } @@ -751,6 +751,11 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte recreateSpinner(); } public void removeCurrent() { + // Don't try to remove current if there is no backstack to remove from + if(backStack.isEmpty()) { + return; + } + if(currentFragment != null) { currentFragment.setPrimaryFragment(false); } diff --git a/app/src/main/java/github/daneren2005/dsub/adapter/EntryGridAdapter.java b/app/src/main/java/github/daneren2005/dsub/adapter/EntryGridAdapter.java index 5693ba56..71e78e4b 100644 --- a/app/src/main/java/github/daneren2005/dsub/adapter/EntryGridAdapter.java +++ b/app/src/main/java/github/daneren2005/dsub/adapter/EntryGridAdapter.java @@ -19,6 +19,7 @@ import android.content.Context; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; @@ -149,8 +150,11 @@ public class EntryGridAdapter extends SectionAdapter<Entry> { } if(!selected.isEmpty()) { - boolean isStarred = selected.get(0).isStarred(); - menu.findItem(R.id.menu_star).setTitle(isStarred ? R.string.common_unstar : R.string.common_star); + MenuItem starItem = menu.findItem(R.id.menu_star); + if(starItem != null) { + boolean isStarred = selected.get(0).isStarred(); + starItem.setTitle(isStarred ? R.string.common_unstar : R.string.common_star); + } } } } |