diff options
author | lado <herrlado@gmail.com> | 2011-11-06 18:22:06 +0100 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2011-11-06 18:22:06 +0100 |
commit | a06a1440b18320787c5022b3753aa1218c07d065 (patch) | |
tree | 90f61fe4d2e6f24502470314627d3c47d5a1c22e /vdrmanager/src/de/bjusystems | |
parent | ee9a189606a01a6726ba0809e80a81a80fbecf69 (diff) | |
download | vdr-manager-a06a1440b18320787c5022b3753aa1218c07d065.tar.gz vdr-manager-a06a1440b18320787c5022b3753aa1218c07d065.tar.bz2 |
some defensive actions
Diffstat (limited to 'vdrmanager/src/de/bjusystems')
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java index f0622be..c699d24 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java @@ -80,11 +80,14 @@ public class EpgDetailsActivity extends Activity implements OnClickListener, event_left = (ImageButton) findViewById(R.id.epg_event_left); event_right = (ImageButton) findViewById(R.id.epg_event_right); state = (ImageView) findViewById(R.id.epg_timer_state); - + + final Event epg = getApp().getCurrentEvent(); + if(epg == null){ + finish(); + } + new VoidAsyncTask() { - private Event epg; - @Override protected void onPreExecute() { setProgressBarIndeterminateVisibility(true); @@ -95,7 +98,6 @@ public class EpgDetailsActivity extends Activity implements OnClickListener, // current event final VdrManagerApp app = (VdrManagerApp) getApplication(); epgs = app.getCurrentEpgList(); - epg = app.getCurrentEvent(); counter = 0; for (Event e : epgs) { @@ -104,6 +106,9 @@ public class EpgDetailsActivity extends Activity implements OnClickListener, } counter++; } + if(counter > epgs.size()){ + counter = -1; + } return (Void) null; } @@ -130,6 +135,10 @@ public class EpgDetailsActivity extends Activity implements OnClickListener, cEvent = event; + if(cEvent == null){ + return; + } + String cn = event.getChannelName(); setTitle(getString(R.string.epg_of_a_channel, cn, counter + 1, epgs.size())); @@ -404,6 +413,9 @@ public class EpgDetailsActivity extends Activity implements OnClickListener, } private void prevEPG() { + if(counter == -1){ + return; + } Event epg; if (counter == 0) { say(R.string.navigae_at_the_start); @@ -441,6 +453,9 @@ public class EpgDetailsActivity extends Activity implements OnClickListener, * } } */ private void nextEPG() { + if(counter == -1){ + return; + } if (counter < epgs.size() - 1) { counter++; Event epg = epgs.get(counter); |