Capture current URI before proceeding with null-check.

This commit is contained in:
Alex Hart
2025-11-24 10:47:46 -04:00
parent 03bbf196c8
commit 246abb9b80

View File

@@ -171,13 +171,14 @@ public class AudioRecorder {
*/ */
@Nullable @Nullable
public VoiceNoteDraft getCurrentRecordingSnapshot() { public VoiceNoteDraft getCurrentRecordingSnapshot() {
if (recordingUri == null) { Uri currentUri = recordingUri;
if (currentUri == null) {
return null; return null;
} }
try { try {
long size = MediaUtil.getMediaSize(context, recordingUri); long size = MediaUtil.getMediaSize(context, currentUri);
return new VoiceNoteDraft(recordingUri, size); return new VoiceNoteDraft(currentUri, size);
} catch (IOException e) { } catch (IOException e) {
Log.w(TAG, "Error getting current recording snapshot", e); Log.w(TAG, "Error getting current recording snapshot", e);
return null; return null;