From 953e2084f9f4db14ff9e08a8f951392f1c00b4b0 Mon Sep 17 00:00:00 2001 From: Patrick Schneider Date: Sun, 15 Jan 2023 15:18:43 +0100 Subject: [PATCH] Fixes: #133 App crashes on try to export an audio note whilst creating a new audio note, but without recording anything. --- .../privacyfriendlynotes/ui/notes/AudioNoteActivity.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlynotes/ui/notes/AudioNoteActivity.kt b/app/src/main/java/org/secuso/privacyfriendlynotes/ui/notes/AudioNoteActivity.kt index 5e54d6d0..1d5d852d 100644 --- a/app/src/main/java/org/secuso/privacyfriendlynotes/ui/notes/AudioNoteActivity.kt +++ b/app/src/main/java/org/secuso/privacyfriendlynotes/ui/notes/AudioNoteActivity.kt @@ -283,9 +283,10 @@ class AudioNoteActivity : BaseNoteActivity(DbContract.NoteEntry.TYPE_AUDIO) { destination = FileOutputStream(file).channel destination.transferFrom(source, 0, source.size()) } finally { - source!!.close() - destination!!.close() + source?.close() + destination?.close() } + // Tell the media scanner about the new file so that it is // immediately available to the user. MediaScannerConnection.scanFile(