Skip to content
Snippets Groups Projects
Verified Commit 428247b7 authored by akwizgran's avatar akwizgran
Browse files

Initialise result LiveData before starting task.

parent a921361a
No related branches found
No related tags found
No related merge requests found
...@@ -76,6 +76,8 @@ class AttachmentCreatorImpl implements AttachmentCreator { ...@@ -76,6 +76,8 @@ class AttachmentCreatorImpl implements AttachmentCreator {
LiveData<GroupId> groupId, Collection<Uri> newUris) { LiveData<GroupId> groupId, Collection<Uri> newUris) {
if (task != null || result != null || !uris.isEmpty()) if (task != null || result != null || !uris.isEmpty())
throw new IllegalStateException(); throw new IllegalStateException();
MutableLiveData<AttachmentResult> result = new MutableLiveData<>();
this.result = result;
uris.addAll(newUris); uris.addAll(newUris);
observeForeverOnce(groupId, id -> { observeForeverOnce(groupId, id -> {
if (id == null) throw new IllegalStateException(); if (id == null) throw new IllegalStateException();
...@@ -85,8 +87,6 @@ class AttachmentCreatorImpl implements AttachmentCreator { ...@@ -85,8 +87,6 @@ class AttachmentCreatorImpl implements AttachmentCreator {
uris, needsSize); uris, needsSize);
ioExecutor.execute(() -> task.storeAttachments()); ioExecutor.execute(() -> task.storeAttachments());
}); });
MutableLiveData<AttachmentResult> result = new MutableLiveData<>();
this.result = result;
return result; return result;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment