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
public VoiceNoteDraft getCurrentRecordingSnapshot() {
if (recordingUri == null) {
Uri currentUri = recordingUri;
if (currentUri == null) {
return null;
}
try {
long size = MediaUtil.getMediaSize(context, recordingUri);
return new VoiceNoteDraft(recordingUri, size);
long size = MediaUtil.getMediaSize(context, currentUri);
return new VoiceNoteDraft(currentUri, size);
} catch (IOException e) {
Log.w(TAG, "Error getting current recording snapshot", e);
return null;