Handle null intent in onStartCommand().
This commit is contained in:
parent
b21cf17cea
commit
1a8ae49f79
1 changed files with 4 additions and 2 deletions
|
@ -36,8 +36,10 @@ class ChatService extends Service {
|
|||
override def onBind(intent: Intent) = binder
|
||||
|
||||
override def onStartCommand(intent: Intent, flags: Int, startId: Int): Int = {
|
||||
if (intent.getAction == ChatService.ActionNetworkChanged)
|
||||
connectionHandler.internetConnectionChanged()
|
||||
Option(intent).foreach { i =>
|
||||
if (i.getAction == ChatService.ActionNetworkChanged)
|
||||
connectionHandler.internetConnectionChanged()
|
||||
}
|
||||
|
||||
Service.START_STICKY
|
||||
}
|
||||
|
|
Reference in a new issue