From f19f8d8ffa9b6c7c4fde5d23bc863338561bd4ce Mon Sep 17 00:00:00 2001 From: Max Lv Date: Sun, 30 Jul 2017 15:32:48 +0800 Subject: [PATCH] Fix a crash when no profile selected --- .../src/main/scala/com/github/shadowsocks/BaseService.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mobile/src/main/scala/com/github/shadowsocks/BaseService.scala b/mobile/src/main/scala/com/github/shadowsocks/BaseService.scala index f5682e57..cd08966d 100644 --- a/mobile/src/main/scala/com/github/shadowsocks/BaseService.scala +++ b/mobile/src/main/scala/com/github/shadowsocks/BaseService.scala @@ -253,7 +253,13 @@ trait BaseService extends Service { case State.STOPPED | State.IDLE => case _ => return Service.START_NOT_STICKY // ignore request } + profile = app.currentProfile.orNull + if (profile == null) { + stopRunner(stopService = true) + return Service.START_NOT_STICKY + } + profile.name = profile.getName // save original name before it's (possibly) overwritten by IP addresses TrafficMonitor.reset()