aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/BackgroundTask.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/util/BackgroundTask.java b/app/src/main/java/github/daneren2005/dsub/util/BackgroundTask.java
index fce855fe..31e83200 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/BackgroundTask.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/BackgroundTask.java
@@ -208,8 +208,18 @@ public abstract class BackgroundTask<T> implements ProgressListener {
handler.post(new Runnable() {
@Override
public void run() {
- if(!isCancelled()) {
- onDone(result);
+ if (!isCancelled()) {
+ try {
+ onDone(result);
+ } catch (Throwable t) {
+ if(!isCancelled()) {
+ try {
+ onError(t);
+ } catch(Exception e) {
+ // Don't care
+ }
+ }
+ }
}
taskStart.set(false);