Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit e7a0a52

Browse files
committed
Check for disposed emitter when emitting new items
1 parent 849ea8e commit e7a0a52

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

firebase-fetcher/src/main/java/com/ackee/versionupdatehandler/FirebaseVersionFetcher.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ public void onComplete(@NonNull Task<Void> task) {
5555
if (task.isSuccessful()) {
5656
FirebaseRemoteConfig.getInstance().activateFetched();
5757
} else {
58-
59-
emitter.onError(new VersionFetchError());
58+
if (!emitter.isDisposed()) {
59+
emitter.onError(new VersionFetchError());
60+
}
6061
}
6162
long minimalVersion = FirebaseRemoteConfig.getInstance().getLong(minimalAttributeName);
6263
long currentVersion = FirebaseRemoteConfig.getInstance().getLong(currentAttributeName);
63-
64-
emitter.onSuccess(new BasicVersionsConfiguration(minimalVersion, currentVersion));
64+
if (!emitter.isDisposed()) {
65+
emitter.onSuccess(new BasicVersionsConfiguration(minimalVersion, currentVersion));
66+
}
6567
}
6668
});
6769
}

0 commit comments

Comments
 (0)