From 9bfe3e3950b43485b4557e54aae622d7e57faa26 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 14 Jun 2016 17:24:31 -0700 Subject: try/catch onDone results as well --- .../java/github/daneren2005/dsub/util/BackgroundTask.java | 14 ++++++++++++-- 1 file 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 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); -- cgit v1.2.3