Bimba.git

commit f8d1e22b93b6149c6b74ebf8f22055135398c85d

Author: Adam Pioterek <adam.pioterek@protonmail.ch>

quick fix VmClient

 app/src/main/java/ml/adamsprogs/bimba/datasources/VmClient.kt | 5 +++--


diff --git a/app/src/main/java/ml/adamsprogs/bimba/datasources/VmClient.kt b/app/src/main/java/ml/adamsprogs/bimba/datasources/VmClient.kt
index 967f5d281d1f3c35100771deb2504e6d994c9786..bf703cca766ddb831b2069b1e778f3a979858694 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/datasources/VmClient.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/datasources/VmClient.kt
@@ -36,7 +36,7 @@             handler!!.postDelayed(this, TICK_6_ZINA_TIM)
             try {
                 for (plateId in requests.keys)
                     downloadVM()
-            } catch (e: ConcurrentModificationException) { //fixme
+            } catch (e: IllegalArgumentException) {
             }
         }
     }
@@ -150,6 +150,7 @@
     override fun onDestroy() {
     }
 
+    @Synchronized
     private fun downloadVM() {
         vms.forEach {
             downloadVM(StopSegment(it.key, it.value.map { it.id }.toSet()))
@@ -203,7 +204,7 @@
     private fun downloadVM(plateId: Plate.ID, times: List<*>) {
         val date = Calendar.getInstance()
         val todayDay = "${date.get(Calendar.DATE)}".padStart(2, '0')
-        val todayMode = timetable!!.calendarToMode(AgencyAndId(timetable.getServiceForToday().id))
+        val todayMode = timetable!!.calendarToMode(AgencyAndId(timetable.getServiceForToday().id)) // fixme when no timetable use service == -1 for `today`
 
         val departures = HashSet<Departure>()