diff --git a/src/org/thoughtcrime/securesms/service/MessageRetrievalService.java b/src/org/thoughtcrime/securesms/service/MessageRetrievalService.java index 7d7ad0b0f27..4cbcdd1933f 100644 --- a/src/org/thoughtcrime/securesms/service/MessageRetrievalService.java +++ b/src/org/thoughtcrime/securesms/service/MessageRetrievalService.java @@ -182,10 +182,14 @@ public static void registerActivityStopped(Context activity) { return pipe; } - private class MessageRetrievalThread extends Thread { + private class MessageRetrievalThread extends Thread implements Thread.UncaughtExceptionHandler { private AtomicBoolean stopThread = new AtomicBoolean(false); + MessageRetrievalThread() { + setUncaughtExceptionHandler(this); + } + @Override public void run() { while (!stopThread.get()) { @@ -235,5 +239,11 @@ public void onMessage(SignalServiceEnvelope envelope) { public void stopThread() { stopThread.set(true); } + + @Override + public void uncaughtException(Thread t, Throwable e) { + Log.w(TAG, "*** Uncaught exception!"); + Log.w(TAG, e); + } } }