From 017f420d42df3d5b4c240143b1a5b0ab18cc5113 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 30 Mar 2020 03:25:47 -0600 Subject: [PATCH] LogViewerActivity: don't crash if pipe closes Signed-off-by: Jason A. Donenfeld --- .../java/com/wireguard/android/activity/LogViewerActivity.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/src/main/java/com/wireguard/android/activity/LogViewerActivity.kt b/ui/src/main/java/com/wireguard/android/activity/LogViewerActivity.kt index d95913ed..87fdc236 100644 --- a/ui/src/main/java/com/wireguard/android/activity/LogViewerActivity.kt +++ b/ui/src/main/java/com/wireguard/android/activity/LogViewerActivity.kt @@ -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) { + } } } }