From 0cc94f8e029e8edfea9caedcbf9dfe3ff9fa4504 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 23:38:36 +0200 Subject: [PATCH] check null file output stream at exporting events --- .../com/simplemobiletools/calendar/helpers/IcsExporter.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/IcsExporter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/IcsExporter.kt index d64b69e3b..e2bdbb2aa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/IcsExporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/IcsExporter.kt @@ -19,6 +19,11 @@ class IcsExporter { fun exportEvents(activity: SimpleActivity, file: File, events: ArrayList, callback: (result: ExportResult) -> Unit) { activity.getFileOutputStream(file) { + if (it == null) { + callback(EXPORT_FAIL) + return@getFileOutputStream + } + it.bufferedWriter().use { out -> out.writeLn(BEGIN_CALENDAR) for (event in events) {