Postpone crash for devices without Wi-Fi

This commit is contained in:
Mygod
2018-03-08 01:05:18 -08:00
parent c7e1abb585
commit d2e9ff226c

View File

@@ -168,8 +168,12 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, VpnMonitor.Ca
override fun onCreate() {
super.onCreate()
p2pManager = getSystemService(Context.WIFI_P2P_SERVICE) as WifiP2pManager
onChannelDisconnected()
try {
p2pManager = getSystemService(Context.WIFI_P2P_SERVICE) as WifiP2pManager
onChannelDisconnected()
} catch (exc: TypeCastException) {
exc.printStackTrace()
}
}
override fun onBind(intent: Intent) = binder