prevent crash

This commit is contained in:
Milos Kozak 2022-02-20 15:24:21 +01:00
parent 0aa34a3fb4
commit 8b74928422

View file

@ -278,7 +278,7 @@ class AutomationPlugin @Inject constructor(
@Synchronized
fun removeIfExists(event: AutomationEvent) {
for (e in automationEvents) {
for (e in automationEvents.reversed()) {
if (event.title == e.title) {
automationEvents.remove(e)
rxBus.send(EventAutomationDataChanged())
@ -301,6 +301,7 @@ class AutomationPlugin @Inject constructor(
@Synchronized
fun at(index: Int) = automationEvents[index]
@Synchronized
fun size() = automationEvents.size
@Synchronized
@ -309,6 +310,7 @@ class AutomationPlugin @Inject constructor(
rxBus.send(EventAutomationDataChanged())
}
@Synchronized
fun userEvents(): List<AutomationEvent> {
val list = mutableListOf<AutomationEvent>()
val iterator: MutableIterator<AutomationEvent> = automationEvents.iterator()