check null file output stream at exporting events

This commit is contained in:
tibbi 2017-09-05 23:38:36 +02:00
parent ec5dd1c852
commit 0cc94f8e02
1 changed files with 5 additions and 0 deletions

View File

@ -19,6 +19,11 @@ class IcsExporter {
fun exportEvents(activity: SimpleActivity, file: File, events: ArrayList<Event>, 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) {