Repository: eventfahrplan/eventfahrplan
Issue: IllegalStateException: Lecture list does not contain eventId

Crash report from users:

- Sent: 25.12.2018
- App version: [v.1.38.0](https://github.com/EventFahrplan/EventFahrplan/releases/tag/v.1.38.0), [v.1.38.1](https://github.com/EventFahrplan/EventFahrplan/releases/tag/v.1.38.1), [v.1.38.2](https://github.com/EventFahrplan/EventFahrplan/releases/tag/v.1.38.2)
- Android version: 8.0.0
- Device model: -

# Stacktrace
``` java
java.lang.IllegalStateException: Lecture list does not contain eventId: 1020
  at nerd.tuxmobil.fahrplan.congress.details.EventDetailFragment.eventIdToLecture(EventDetailFragment.java:337)
  at nerd.tuxmobil.fahrplan.congress.details.EventDetailFragment.onOptionsItemSelected(EventDetailFragment.java:384)
  at android.support.v4.app.Fragment.performOptionsItemSelected(Fragment.java:2487)
  at android.support.v4.app.FragmentManagerImpl.dispatchOptionsItemSelected(FragmentManager.java:3307)
  at android.support.v4.app.FragmentController.dispatchOptionsItemSelected(FragmentController.java:344)
  at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:374)
  at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:195)
  at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:108)
  at android.support.v7.app.AppCompatDelegateImplV9.onMenuItemSelected(AppCompatDelegateImplV9.java:674)
  at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:822)
  at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:171)
  at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:973)
  at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:963)
  at android.support.v7.widget.ActionMenuView.invokeItem(ActionMenuView.java:624)
  at android.support.v7.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:150)
  at android.view.View.performClick(View.java:6291)
  at android.view.View$PerformClick.run(View.java:24931)
  at android.os.Handler.handleCallback(Handler.java:808)
  at android.os.Handler.dispatchMessage(Handler.java:101)
  at android.os.Looper.loop(Looper.java:166)
  at android.app.ActivityThread.main(ActivityThread.java:7425)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)

```

# Log
``` java
0 D: Writing unhandled exception to: /data/user/0/info.metadude.android.congress.schedule/files/1.38.1-1545740988461.tracedroid
1 D: MyApp.meta = Meta(dayChangeHour=0, dayChangeMinute=0, eTag="70089e17658f6ea3df96cefb1d67ff3c6f46fbd6", numDays=4, subtitle=, title=35th Chaos Communication Congress, version=Columbo 3 1.6 v1.7 0.5 1.0.2 2018-12-24 12:40)
2 D: viewDay(false)
3 D: meta.getNumDays() = 4
4 D: MyApp.task_running = NONE
5 D: MyApp.meta = Meta(dayChangeHour=0, dayChangeMinute=0, eTag="70089e17658f6ea3df96cefb1d67ff3c6f46fbd6", numDays=4, subtitle=, title=35th Chaos Communication Congress, version=Columbo 3 1.6 v1.7 0.5 1.0.2 2018-12-24 12:40)
6 D: viewDay(false)
7 D: lecture_id = null
8 D: MyApp.lectureList contains 192 items.
9 D: onResume

10 D: MyApp.meta = Meta(dayChangeHour=0, dayChangeMinute=0, eTag="70089e17658f6ea3df96cefb1d67ff3c6f46fbd6", numDays=4, subtitle=, title=35th Chaos Communication Congress, version=Columbo 3 1.6 v1.7 0.5 1.0.2 2018-12-24 12:40)
11 D: viewDay(false)
12 D: meta.getNumDays() = 4
13 D: MyApp.task_running = NONE
14 D: MyApp.meta = Meta(dayChangeHour=0, dayChangeMinute=0, eTag="70089e17658f6ea3df96cefb1d67ff3c6f46fbd6", numDays=4, subtitle=, title=35th Chaos Communication Congress, version=Columbo 3 1.6 v1.7 0.5 1.0.2 2018-12-24 12:40)
15 D: viewDay(false)
16 D: lecture_id = null
17 D: MyApp.lectureList contains 192 items.
18 D: onResume

19 D: MyApp.meta = Meta(dayChangeHour=0, dayChangeMinute=0, eTag="70089e17658f6ea3df96cefb1d67ff3c6f46fbd6", numDays=4, subtitle=, title=35th Chaos Communication Congress, version=Columbo 3 1.6 v1.7 0.5 1.0.2 2018-12-24 12:40)
20 D: viewDay(false)
21 D: meta.getNumDays() = 4
22 D: MyApp.task_running = NONE
23 D: MyApp.meta = Meta(dayChangeHour=0, dayChangeMinute=0, eTag="70089e17658f6ea3df96cefb1d67ff3c6f46fbd6", numDays=4, subtitle=, title=35th Chaos Communication Congress, version=Columbo 3 1.6 v1.7 0.5 1.0.2 2018-12-24 12:40)
24 D: viewDay(false)
25 D: lecture_id = null
26 D: MyApp.lectureList contains 174 items.
27 D: onResume

28 D: MyApp.meta = Meta(dayChangeHour=0, dayChangeMinute=0, eTag="70089e17658f6ea3df96cefb1d67ff3c6f46fbd6", numDays=4, subtitle=, title=35th Chaos Communication Congress, version=Columbo 3 1.6 v1.7 0.5 1.0.2 2018-12-24 12:40)
29 D: viewDay(false)
30 D: meta.getNumDays() = 4
31 D: MyApp.task_running = NONE
32 D: MyApp.meta = Meta(dayChangeHour=0, dayChangeMinute=0, eTag="70089e17658f6ea3df96cefb1d67ff3c6f46fbd6", numDays=4, subtitle=, title=35th Chaos Communication Congress, version=Columbo 3 1.6 v1.7 0.5 1.0.2 2018-12-24 12:40)
33 D: viewDay(false)
34 D: lecture_id = null
35 D: MyApp.lectureList = null
36 D: onResume

37 D: current handler class=com.android.internal.os.RuntimeInit$KillApplicationHandler
```

- Above logging has been added in 473f35a68b3f9c13f55411146b6d7ddd361ddfd9 and has been released with v.1.38.1

# Related
- [Issue #81: EventDetailFragment: IllegalArgumentException: Parameter specified as non-null is null: parameter event](https://github.com/EventFahrplan/EventFahrplan/issues/81)
- [Pull request #87: Fix crash when EventDetailFragment attempts to be load with an non existing "event_id".](https://github.com/EventFahrplan/EventFahrplan/pull/87)

Changed files:
app/src/main/java/nerd/tuxmobil/fahrplan/congress/utils/FahrplanMisc.java

diff --git a/app/src/main/java/nerd/tuxmobil/fahrplan/congress/utils/FahrplanMisc.java b/app/src/main/java/nerd/tuxmobil/fahrplan/congress/utils/FahrplanMisc.java
index e94fb95d..8f351c9e 100644
--- a/app/src/main/java/nerd/tuxmobil/fahrplan/congress/utils/FahrplanMisc.java
+++ b/app/src/main/java/nerd/tuxmobil/fahrplan/congress/utils/FahrplanMisc.java
@@ -274,6 +274,9 @@ public class FahrplanMisc {
             if (!l.highlight) {
                 starredList.remove(l);
             }
+            if (l.changedIsCanceled) {
+                starredList.remove(l);
+            }
             lectureIndex--;
         }
         MyApp.LogDebug(LOG_TAG, starredList.size() + " lectures starred.");