Skip to content

Commit 3657487

Browse files
committed
Add missing global error handler.
1 parent 8cd87ad commit 3657487

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/src/main/java/fr/free/nrw/commons/CommonsApplication.java

+5
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
import fr.free.nrw.commons.upload.FileUtils;
4545
import fr.free.nrw.commons.utils.ConfigUtils;
4646
import io.reactivex.android.schedulers.AndroidSchedulers;
47+
import io.reactivex.internal.functions.Functions;
48+
import io.reactivex.plugins.RxJavaPlugins;
4749
import io.reactivex.schedulers.Schedulers;
4850
import timber.log.Timber;
4951

@@ -128,6 +130,9 @@ public void onCreate() {
128130

129131
createNotificationChannel(this);
130132

133+
// This handler will catch exceptions thrown from Observables after they are disposed,
134+
// or from Observables that are (deliberately or not) missing an onError handler.
135+
RxJavaPlugins.setErrorHandler(Functions.emptyConsumer());
131136

132137
if (setupLeakCanary() == RefWatcher.DISABLED) {
133138
return;

0 commit comments

Comments
 (0)