Merge pull request #1430 from bemusementpark/fix-null-display-name

Fix NPE on null display name
pull/1439/head
Andrew 3 months ago committed by GitHub
commit 36edca855c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -182,7 +182,7 @@ open class Storage(
}
override fun getUserProfile(): Profile {
val displayName = TextSecurePreferences.getProfileName(context)!!
val displayName = TextSecurePreferences.getProfileName(context)
val profileKey = ProfileKeyUtil.getProfileKey(context)
val profilePictureUrl = TextSecurePreferences.getProfilePictureURL(context)
return Profile(displayName, profileKey, profilePictureUrl)

@ -4,10 +4,11 @@ import com.google.protobuf.ByteString
import org.session.libsignal.utilities.Log
import org.session.libsignal.protos.SignalServiceProtos
class Profile() {
var displayName: String? = null
var profileKey: ByteArray? = null
class Profile(
var displayName: String? = null,
var profileKey: ByteArray? = null,
var profilePictureURL: String? = null
) {
companion object {
const val TAG = "Profile"
@ -25,12 +26,6 @@ class Profile() {
}
}
constructor(displayName: String, profileKey: ByteArray? = null, profilePictureURL: String? = null) : this() {
this.displayName = displayName
this.profileKey = profileKey
this.profilePictureURL = profilePictureURL
}
fun toProto(): SignalServiceProtos.DataMessage? {
val displayName = displayName
if (displayName == null) {

Loading…
Cancel
Save