Use sender onion when we don't have a contact (now will null safety)
This commit is contained in:
parent
cf3e3961ee
commit
d5dbecddfa
|
@ -29,8 +29,12 @@ class MessageBubbleState extends State<MessageBubble> {
|
|||
// If the sender is not us, then we want to give them a nickname...
|
||||
var senderDisplayStr = "";
|
||||
if (!fromMe && Provider.of<MessageState>(context).senderOnion != null) {
|
||||
var contact = Provider.of<ProfileInfoState>(context).contactList.getContact(Provider.of<MessageState>(context).senderOnion);
|
||||
senderDisplayStr = contact!.nickname;
|
||||
ContactInfoState? contact = Provider.of<ProfileInfoState>(context).contactList.getContact(Provider.of<MessageState>(context).senderOnion);
|
||||
if (contact != null) {
|
||||
senderDisplayStr = contact.nickname;
|
||||
} else {
|
||||
senderDisplayStr = Provider.of<MessageState>(context).senderOnion;
|
||||
}
|
||||
}
|
||||
var wdgSender = SelectableText(senderDisplayStr,
|
||||
style: TextStyle(fontSize: 9.0, color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeTextColor() : Provider.of<Settings>(context).theme.messageFromOtherTextColor()));
|
||||
|
|
Loading…
Reference in New Issue