diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt index 02aa41992..ef8f6bbb6 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt @@ -103,9 +103,11 @@ class FlashViewModel : BaseViewModel() { val name = "magisk_install_log_%s.log".format(now.toTime(timeFormatStandard)) val file = MediaStoreUtils.getFile(name, true) file.uri.outputStream().bufferedWriter().use { writer -> - logItems.forEach { - writer.write(it) - writer.newLine() + synchronized(logItems) { + logItems.forEach { + writer.write(it) + writer.newLine() + } } } SnackbarEvent(file.toString()).publish()