aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2016-06-14 17:24:31 -0700
committerScott Jackson <daneren2005@gmail.com>2016-06-14 17:24:31 -0700
commit9bfe3e3950b43485b4557e54aae622d7e57faa26 (patch)
tree659a926fc9babf73998862530e36f2d144760d10
parent229a45cbded29c975d29d60e3b879266c32e3fbe (diff)
downloaddsub-9bfe3e3950b43485b4557e54aae622d7e57faa26.tar.gz
dsub-9bfe3e3950b43485b4557e54aae622d7e57faa26.tar.bz2
dsub-9bfe3e3950b43485b4557e54aae622d7e57faa26.zip
try/catch onDone results as well
-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);