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 if (mode != "r") return null
val log = logForUri(uri) ?: return null val log = logForUri(uri) ?: return null
return openPipeHelper(uri, "text/plain", null, log) { output, _, _, _, l -> return openPipeHelper(uri, "text/plain", null, log) { output, _, _, _, l ->
try {
FileOutputStream(output.fileDescriptor).write(l!!) FileOutputStream(output.fileDescriptor).write(l!!)
} catch (_: Exception) {
}
} }
} }
} }