mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-23 00:17:34 +00:00
Fix NPE on null display name
This commit is contained in:
parent
e68290b572
commit
3cba05e668
@ -182,7 +182,7 @@ open class Storage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getUserProfile(): Profile {
|
override fun getUserProfile(): Profile {
|
||||||
val displayName = TextSecurePreferences.getProfileName(context)!!
|
val displayName = TextSecurePreferences.getProfileName(context)
|
||||||
val profileKey = ProfileKeyUtil.getProfileKey(context)
|
val profileKey = ProfileKeyUtil.getProfileKey(context)
|
||||||
val profilePictureUrl = TextSecurePreferences.getProfilePictureURL(context)
|
val profilePictureUrl = TextSecurePreferences.getProfilePictureURL(context)
|
||||||
return Profile(displayName, profileKey, profilePictureUrl)
|
return Profile(displayName, profileKey, profilePictureUrl)
|
||||||
|
@ -4,10 +4,11 @@ import com.google.protobuf.ByteString
|
|||||||
import org.session.libsignal.utilities.Log
|
import org.session.libsignal.utilities.Log
|
||||||
import org.session.libsignal.protos.SignalServiceProtos
|
import org.session.libsignal.protos.SignalServiceProtos
|
||||||
|
|
||||||
class Profile() {
|
class Profile(
|
||||||
var displayName: String? = null
|
var displayName: String? = null,
|
||||||
var profileKey: ByteArray? = null
|
var profileKey: ByteArray? = null,
|
||||||
var profilePictureURL: String? = null
|
var profilePictureURL: String? = null
|
||||||
|
) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "Profile"
|
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? {
|
fun toProto(): SignalServiceProtos.DataMessage? {
|
||||||
val displayName = displayName
|
val displayName = displayName
|
||||||
if (displayName == null) {
|
if (displayName == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user