Skip to content

Commit

Permalink
fix: intent null bugs and prepareMainLooper
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhouYixun committed Jan 20, 2023
1 parent cfa0a36 commit bc1ee16
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ data class SonicWifiPacket(

data class SonicWifiInfo(
var SSID: String = "",
var BSSID: String = "",
var BSSID: String ?= "",
var capabilities: String = "",
var ipAddress: String = "",
var macAddress: String = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class SonicPluginTouchService(var width: Int = 0, var handler: Handler?) :
@JvmStatic
fun main(args: Array<String>) {
try {
Looper.prepare()
Looper.prepareMainLooper()
val handler = Handler()
val size: Point? = getScreenSize()
if (size != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class SonicManagerServiceV2 : Service(), TcpServerListener {

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
LogUtils.i("onStartCommand")
val action = intent!!.action
val action = intent?.action
if (ACTION_STOP == action) {
closeSocket()
return START_NOT_STICKY
Expand Down Expand Up @@ -232,7 +232,7 @@ class SonicManagerServiceV2 : Service(), TcpServerListener {
private fun closeSocket() {
isSocketStop = true
mSonicTcpServer?.let {
if(it.isListening()) {
if (it.isListening()) {
it.removeTcpServerListener(this)
it.stopServer()
}
Expand Down

0 comments on commit bc1ee16

Please sign in to comment.