From 929b8c94aef476063c2c049c6ea7a22860eabade Mon Sep 17 00:00:00 2001 From: Mygod Date: Fri, 8 Jul 2016 12:58:11 +0800 Subject: [PATCH] Ignore exceptions while unbinding service --- .../scala/com/github/shadowsocks/ServiceBoundContext.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/scala/com/github/shadowsocks/ServiceBoundContext.scala b/src/main/scala/com/github/shadowsocks/ServiceBoundContext.scala index 40ec6f3e..debd6cef 100644 --- a/src/main/scala/com/github/shadowsocks/ServiceBoundContext.scala +++ b/src/main/scala/com/github/shadowsocks/ServiceBoundContext.scala @@ -69,7 +69,9 @@ trait ServiceBoundContext extends Context with IBinder.DeathRecipient { unregisterCallback callback = null if (connection != null) { - unbindService(connection) + try unbindService(connection) catch { + case _: IllegalArgumentException => // ignore + } connection = null } if (binder != null) {