From 428247b7b2e8fdd4d76209fcda4188e908d5725b Mon Sep 17 00:00:00 2001 From: akwizgran Date: Wed, 26 Jun 2019 14:31:40 +0100 Subject: [PATCH] Initialise result LiveData before starting task. --- .../briar/android/attachment/AttachmentCreatorImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/briar-android/src/main/java/org/briarproject/briar/android/attachment/AttachmentCreatorImpl.java b/briar-android/src/main/java/org/briarproject/briar/android/attachment/AttachmentCreatorImpl.java index e78be6805..53687f48b 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/attachment/AttachmentCreatorImpl.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/attachment/AttachmentCreatorImpl.java @@ -76,6 +76,8 @@ class AttachmentCreatorImpl implements AttachmentCreator { LiveData groupId, Collection newUris) { if (task != null || result != null || !uris.isEmpty()) throw new IllegalStateException(); + MutableLiveData result = new MutableLiveData<>(); + this.result = result; uris.addAll(newUris); observeForeverOnce(groupId, id -> { if (id == null) throw new IllegalStateException(); @@ -85,8 +87,6 @@ class AttachmentCreatorImpl implements AttachmentCreator { uris, needsSize); ioExecutor.execute(() -> task.storeAttachments()); }); - MutableLiveData result = new MutableLiveData<>(); - this.result = result; return result; }