diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-03-20 19:56:55 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-03-20 19:56:55 -0700 |
commit | e2d272e905c0350af19a773c80a29270cde3e5d4 (patch) | |
tree | 7ec2ef4355f9fe94eef6941d867471e052cfcfb4 /src/github | |
parent | 9736e06e4a3edef265241500a6ce31444327edf0 (diff) | |
download | dsub-e2d272e905c0350af19a773c80a29270cde3e5d4.tar.gz dsub-e2d272e905c0350af19a773c80a29270cde3e5d4.tar.bz2 dsub-e2d272e905c0350af19a773c80a29270cde3e5d4.zip |
Add try/catch blocks to create options menu in case called before context is valid
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/activity/SubsonicActivity.java | 6 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/MainFragment.java | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java index e3094546..d5821dac 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -348,7 +348,11 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte if(drawerOpen) {
menuInflater.inflate(R.menu.drawer_menu, menu);
} else if(currentFragment != null) {
- currentFragment.onCreateOptionsMenu(menu, menuInflater);
+ try {
+ currentFragment.onCreateOptionsMenu(menu, menuInflater);
+ } catch(Exception e) {
+ Log.w(TAG, "Error on creating options menu", e);
+ }
}
return true;
}
diff --git a/src/github/daneren2005/dsub/fragments/MainFragment.java b/src/github/daneren2005/dsub/fragments/MainFragment.java index 7225f551..fb36c9e3 100644 --- a/src/github/daneren2005/dsub/fragments/MainFragment.java +++ b/src/github/daneren2005/dsub/fragments/MainFragment.java @@ -78,8 +78,12 @@ public class MainFragment extends SubsonicFragment { public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
menuInflater.inflate(R.menu.main, menu);
- if(!ServerInfo.isMadsonic(context) || !UserUtil.isCurrentAdmin()) {
- menu.setGroupVisible(R.id.madsonic, false);
+ try {
+ if (!ServerInfo.isMadsonic(context) || !UserUtil.isCurrentAdmin()) {
+ menu.setGroupVisible(R.id.madsonic, false);
+ }
+ } catch(Exception e) {
+ Log.w(TAG, "Error on setting madsonic invisible", e);
}
}
|