LogViewerActivity: don't crash if pipe closes

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-03-30 03:25:47 -06:00
parent bc186fe6ad
commit 017f420d42

View File

@ -346,7 +346,10 @@ class LogViewerActivity : AppCompatActivity() {
if (mode != "r") return null
val log = logForUri(uri) ?: return null
return openPipeHelper(uri, "text/plain", null, log) { output, _, _, _, l ->
FileOutputStream(output.fileDescriptor).write(l!!)
try {
FileOutputStream(output.fileDescriptor).write(l!!)
} catch (_: Exception) {
}
}
}
}