Handle null intent in onStartCommand().

This commit is contained in:
Felix Ableitner 2015-12-17 01:55:32 +01:00
parent b21cf17cea
commit 1a8ae49f79

View file

@ -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
}