Skip to content

Commit 4629b61

Browse files
committed
1. 简化代码
1 parent 67b62c2 commit 4629b61

File tree

1 file changed

+2
-4
lines changed
  • wechaty/src/main/kotlin/io/github/wechaty/user

1 file changed

+2
-4
lines changed

wechaty/src/main/kotlin/io/github/wechaty/user/Contact.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ open class Contact(wechaty: Wechaty,val id:String) : Sayable, Accessory(wechaty)
112112
fun address(): String {
113113
return this.payload?.address ?: ""
114114
}
115+
115116
fun province(): String {
116117
return this.payload?.province ?: ""
117118
}
@@ -133,11 +134,8 @@ open class Contact(wechaty: Wechaty,val id:String) : Sayable, Accessory(wechaty)
133134
}
134135

135136
fun self(): Boolean {
136-
val userId = this.puppet.selfId()
137+
val userId = this.puppet.selfId() ?: return false
137138

138-
if (userId == null) {
139-
return false
140-
}
141139
return this.id === userId
142140
}
143141

0 commit comments

Comments
 (0)