Commit 5a88984d authored by LoveSy's avatar LoveSy Committed by John Wu

Guard synchronizedList's iteration

It's needed to guard a synchronizedList when iterating it
parent 18de60f6
...@@ -103,11 +103,13 @@ class FlashViewModel : BaseViewModel() { ...@@ -103,11 +103,13 @@ class FlashViewModel : BaseViewModel() {
val name = "magisk_install_log_%s.log".format(now.toTime(timeFormatStandard)) val name = "magisk_install_log_%s.log".format(now.toTime(timeFormatStandard))
val file = MediaStoreUtils.getFile(name, true) val file = MediaStoreUtils.getFile(name, true)
file.uri.outputStream().bufferedWriter().use { writer -> file.uri.outputStream().bufferedWriter().use { writer ->
synchronized(logItems) {
logItems.forEach { logItems.forEach {
writer.write(it) writer.write(it)
writer.newLine() writer.newLine()
} }
} }
}
SnackbarEvent(file.toString()).publish() SnackbarEvent(file.toString()).publish()
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment